|
Boost Users : |
From: abir basak (abirbasak_at_[hidden])
Date: 2007-04-04 09:49:06
Thorsten Ottosen wrote:
> 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
And anyway it can be done for ublas vectors & matrix ?
I am missing this feature so much in some non-STL container classes.
Thanks.
-- Abir Basak, Member IEEE Software Engineer, Read Ink Technologies B. Tech, IIT Kharagpur email: abir_at_[hidden] homepage: www.abirbasak.com
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