🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Making STL user-friendly?? [Re: STL find errorprone]

#1975
From: Fabrice Clerc
Date: Fri, 15 Sep 1995 15:22
53 lines
2125 bytes
In article <4378m2$1n86@news.doit.wisc.edu>, khan@xraylith.wisc.edu (Mumit Khan) writes:
|> This is a rather interesting thread started by Tony Cook in c.std.c++
[...]
|> 
|> 
|> 3. Container member functions -- any new members that you think "ought"
|>    to be added? When it comes to STL, I tend to favor not touching the
|>    container classes and rather favor adding global fcts ala algo.h.
|>

template <class Container>
void clear(Container& c) {

  c.erase(c.begin(),c.end());
}

|> 
|> 8. your turn ...
|>

maybe make containers of pointers a bit easier to use:

o allow "standard" comparison functions to be used with
  containers of pointers:

  set<int*,indirect_apply<less<int> > > spi;

  (boy, that sure is synctatic sugar :-)

o also, I have found

  template <class Iterator>
  void delete_range(Iterator first,Iterator last) {

    while (first!=last) {
      delete *first++;
    }
  }

  useful.


Fabrice
---
Fabrice Clerc
clerc@gla.ecoledoc.ibp.fr




[ 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: <43c3q7$n6q@vishnu.jussieu.fr>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <DED5p2.I2I@online.tmx.com.au> <42hjvb$bj5@jabba.lehman.com> <MATT.95Sep9110458@physics10.Berkeley.EDU> <MATT.95Sep11121604@physics2.berkeley.edu> <4378m2$1n86@news.doit.wisc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: clerc@gla.ecoledoc.ibp.fr (Fabrice Clerc)
Newsgroups: comp.std.c++
Subject: Re: Making STL user-friendly?? [Re: STL find errorprone]
Date: 15 Sep 1995 15:22:57 GMT
Organization: Universites Paris VI/Paris VII - France
Sender: clerc@daisy.UCAR.EDU ()
Approved: clamage@eng.sun.com (comp.std.c++)
Distribution: world
Message-ID: <43c3q7$n6q@vishnu.jussieu.fr>
References: <DED5p2.I2I@online.tmx.com.au> <42hjvb$bj5@jabba.lehman.com> <MATT.95Sep9110458@physics10.Berkeley.EDU> <MATT.95Sep11121604@physics2.berkeley.edu> <4378m2$1n86@news.doit.wisc.edu>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"; conversions="8bit"
Content-Transfer-Encoding: 8bit
X-Nntp-Posting-Host: daisy-gtw.ecoledoc.ibp.fr
X-Lines: 49
Content-Length: 974
Originator: clamage@taumet