Mercurial > hg > octave-lyh
diff liboctave/str-vec.cc @ 2941:b779a5b8aed4
[project @ 1997-05-08 02:14:34 by jwe]
author | jwe |
---|---|
date | Thu, 08 May 1997 02:17:52 +0000 |
parents | c05d4e1a9bee |
children | 443851377f3f |
line wrap: on
line diff
--- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -66,6 +66,27 @@ elem (i) = s[i]; } +string_vector& +string_vector::uniq (void) +{ + int len = length (); + + if (len > 0) + { + int k = 0; + + for (int i = 1; i < len; i++) + if (elem(i) != elem(k)) + if (++k != i) + elem(k) = elem(i); + + if (len != ++k) + resize (k); + } + + return *this; +} + char ** string_vector::c_str_vec (void) const {