Mercurial > hg > octave-nkf
changeset 4220:c20a1e67cef6
[project @ 2002-12-06 22:18:54 by jwe]
author | jwe |
---|---|
date | Fri, 06 Dec 2002 22:18:55 +0000 |
parents | 23d06c9e1edd |
children | a7d8e5dd87ad |
files | liboctave/ChangeLog liboctave/str-vec.cc liboctave/str-vec.h |
diffstat | 3 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,10 @@ 2002-12-06 John W. Eaton <jwe@bevo.che.wisc.edu> + * str-vec.cc (string_vector::compare): New static member function. + * str-vec.h: Provide decl. + (string_vector::sort): Use it. + (str_vec_compare): Delete static function. + * oct-alloc.h (DECLARE_OCTAVE_ALLOCATOR): Also declare and define a placement operator new.
--- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -67,6 +67,15 @@ elem (i) = s[i]; } +int +string_vector::compare (const void *a_arg, const void *b_arg) +{ + const std::string *a = (const std::string *) a_arg; + const std::string *b = (const std::string *) b_arg; + + return a->compare (*b); +} + string_vector& string_vector::uniq (void) {
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -28,15 +28,6 @@ #include "Array.h" -static int -str_vec_compare (const void *a_arg, const void *b_arg) -{ - const std::string *a = (const std::string *) a_arg; - const std::string *b = (const std::string *) b_arg; - - return a->compare (*b); -} - class string_vector : public Array<std::string> { @@ -88,9 +79,11 @@ std::string operator[] (int i) const { return Array<std::string>::elem (i); } + static int compare (const void *a_arg, const void *b_arg); + string_vector& qsort (bool make_unique = false) { - Array<std::string>::qsort (str_vec_compare); + Array<std::string>::qsort (compare); if (make_unique) uniq ();