Boost logo

Boost :

From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2002-02-23 16:21:08


I've uploaded an initial version of auto_sequence to

  http://groups.yahoo.com/group/boost/files/auto_sequence.zip

This follows Dave Abrahams's suggestion of turning my auto_vector
into a container adapter.

You can use it like this (oh for typedef templates):

  boost::auto_deque<foo>::type x;
  boost::auto_list<foo>::type y;
  boost::auto_vector<foo>::type z;

Which are equivalent to

  boost::auto_sequence< std::deque<foo*> > x;
  boost::auto_sequence< std::list<foo*> > y;
  boost::auto_sequence< std::vector<foo*> > z;

If you have some other sequence you wish to use, you could use

  boost::auto_sequence< my_nifty_sequence<foo*> > w;

I've gone for the simple/unsafe approach of allowing you to modify
the contained values:

    z[0] = new foo; // Whoops - memory leak.

so Don't Do That. Personally I've never accidentally done this in
many years of using similar "auto" containers so I don't think it
is a problem. If anyone has strong opinions on whether there is
a better alternative, please speak up.

Please let me know if you think this, or something close to it,
is worthy of documentation and submission.

Thanks
Mark


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk