Zeljko, Thank you for your reply. I'm glad to learn that intrusive remove() follows a known convention in std. I also like your "iterator_of" suggestion. So that leaves me with 2 remaining suggestions, which I'll restate for the record: 1) Since constant-time removal is a rather common task, shouldn't the docs have an example of how to do it properly? You have to dig pretty deeply into the API to figure out a O(0) way to do it. 2) Wouldn't a wrapper function for constant-time element removal be a good addition to the library? Thanks again, -Erik -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Zeljko Vrba Sent: Thursday, February 05, 2009 7:44 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [intrusive] first impression and constant-time removal On Thu, Feb 05, 2009 at 06:44:19AM -0800, Erik Cassel wrote:
1) I found the remove() function's name ambiguous. It isn't clear that the
It fully agrees with the use of the remove() name in the standard <algorithm> header. Calling it something else would break the convention and introduce unnecessary extra learning effort for people acquainted with the standard library. I am actually replying to add item 4: iterator_to is an extremely unintuitive and little informative name which I'm continually stumbling over. The convention is to name the functions according to what they return, so "to_iterator" or "get_iterator" or "iterator_of"[1] would make much more sense. But I guess it's too late to complain about that "bug" now that the library has undergone review and gotten accepted... [1] Note how "iterator_of" is declarative, indicating return value, whereas "iterator_to" is imperative and leads the reader to expect that something will be done with the iterator that is passed in as argument (compare with functions of similar names than one encounters, e.g. "fixed_string_to_int", which takes string as a source argument; functions returning X are conventionally named to_X -- e.g., browse through DateTime library [just a random example]). I see the logic behind a statement like iterator_to(X), but each time I have to use that function, I have to stop, think twice and assure myself that the naming logic really is the opposite of the convention and that the function really does what I need. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users