[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unneccessary helper function
From: |
Ingo Ruhnke |
Subject: |
Re: Unneccessary helper function |
Date: |
07 Jun 2002 21:05:16 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
David Philippi <address@hidden> writes:
> I've just found ListHelper.hh.
> The statement that STL list doesn't provide append is correct. But there is a
> method "void merge(list<T> &)".
> I'd propose to remove the helper and ask everyone to remember the correct
> method of list. It's unfortunate that some methods have different names
> across different containers.
Are you sure that merge() has the same semantics as append()?
,----[ http://www.sgi.com/tech/stl/List.html ]
| void merge(list<T, Alloc>& x);
|
| Both *this and x must be sorted according to operator<, and they must
| be distinct. (That is, it is required that &x != this.) This function
| removes all of x's elements and inserts them in order into *this. The
| merge is stable; that is, if an element from *this is equivalent to
| one from x, then the element from *this will precede the one from x.
| All iterators to elements in *this and x remain valid. This function
| is linear time: it performs at most size() + x.size() - 1 comparisons.
`----
As far as I understand this, it is meant to merge two sorted list into
a single sorted list (mergesort). Its also destructiv to the argument.
This sounds quite a bit different from what my ListHelper::append()
does.
--
Advent: http://www.freesoftware.fsf.org/advent/
Feuerkraft: http://www.freesoftware.fsf.org/feuerkraft/
Pingus: http://pingus.seul.org/ || ICQ: 59461927
Home: http://pingus.seul.org/~grumbel/ || JabberID: address@hidden