Topic: STL/String naming scheme confusion


Author: Nico Josuttis <nico@bredex.de>
Date: 1996/04/12
Raw View
Hi,
Foregive me if I am wrong and sorry, if this sounds like a flame,
but if I try to find a naming scheme for STL
search/find algorithms, it all seems to be a confusion:

Consider:
                         | basic_string       | STL algorithm
-----------------------------------------------------------------
find first elem          | find()             | find()
find last elem           | rfind()            | -
find first subrange      | find()             | search()
find last subrange       | rfind()            | find_end()
find first elem of range | find_first_of()    | find_first_of()
find last elem of range  | find_last_of()     | -

Why don't we use the string naming scheme ?
 - Why is search() not also called find() ?
 - Why is find_end() not called rfind() ?

  (I guess the missing algorithms do miss because
   reverse iterators do the job)

OK, we had not many time but this is somehow typical
for inconsistences in the library and happened of course due
to historical reasons.
For example to append elements, we have
 +=, append, push_back

But it would be possible to get more conistence with only a bit of
work. I think programmers will thank for it (oh certainly they won't,
but they won't flame so much).
And this is the last chance to make it more consistent.

Anything but historical reason against a change for that ?
Am I missing something ?

If not, I could try to make a full table for all such naming
inconsistences to have a base to discuss a consistent solution.

Nico
nico@bredex.de


[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Rich Paul <linguist@cyberspy.com>
Date: 1996/04/15
Raw View
Nico Josuttis wrote:
> Why don't we use the string naming scheme ?
>  - Why is search() not also called find() ?
>  - Why is find_end() not called rfind() ?
>
>   (I guess the missing algorithms do miss because
>    reverse iterators do the job)
>

Without judging which one is better, I'd be quite inclined to
agree that a single naming scheme would be much nicer to deal
with!


--
#include <legalbs/standarddisclaimer>
Rich Paul                |  If you like what I say, tell my
C++, OOD, OOA, OOP,      |  employer, but if you don't,
OOPs, I forgot one ...   |  don't blame them.  ;->
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]