Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-04-03 07:27:05


abir basak skrev:
> Hi,
> I am inheriting a vector for some reason.
> Just like
> template<typename T>
> class my_vector : public std::vector<T>{
> };
> I want my_vector to take the advantage of boost::assign library.
> How to do it?

From

http://www.boost.org/libs/assign/doc/index.html#list_of_ref

it says:

         //
         // Convert to a 'Container'. 'Container' must have a constructor
         // which takes two iterators.
         //
         template< class Container >
         operator Container() const;

so it should simply work out of the box:

   my_vector<T> foo;
   foo += 1,2,3,43;
   my_vector<T> foo = list_of(1)(2)(3);

-Thorsten


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net