🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1920

Re: STL find errorprone

#1920
From: Haim Kreitman
Date: Thu, 07 Sep 1995 15:04
26 lines
1519 bytes
I would say in your example:

        template <class Container, class Item>
        Container::iterator find(Container &c, Item const &v)
        {
            return find(c.begin(), c.end(), v);
        }

So the above becomes:
        Container::iterator i = find(myVector, someInt);
        if (!i)
        {
          // not there
        }


Generally: all global functions from algobase, which takes two pointers 
(start and finish iterators) should have overloaded 'brother'-function
without these arguments to make operation on all elements of the 
container (most usefull case).



[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <42msgo$9db@lyman.pppl.gov>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <DED5p2.I2I@online.tmx.com.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: Haim Kreitman <haim_kreitman@mail.stil.scitex.com>
Newsgroups: comp.std.c++
Subject: Re: STL find errorprone
Date: 7 Sep 1995 15:04:57 GMT
Organization: Scitex LTD
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <42msgo$9db@lyman.pppl.gov>
References: <DED5p2.I2I@online.tmx.com.au>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; conversions="7bit, 7bit"
Content-Transfer-Encoding: 7bit
X-Nntp-Posting-Host: 149.115.14.35
X-Mailer: Mozilla 1.1N (Windows; I; 32bit)
To: tony@online.tmx.com.au
X-Lines: 22
Content-Length: 591
Originator: clamage@taumet