Boost logo

Boost Users :

From: abir basak (abirbasak_at_[hidden])
Date: 2007-04-04 09:46:47


Mark Ruzon wrote:
> abir basak <abirbasak <at> gmail.com> writes:
>
>> 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?
>> Thanks
>> abir
>
> Though it's a little off topic, I want to point out that STL container classes
> were not designed to be base classes; it would be preferable to make a vector<T>
> member variable and add to or subtract from the interface explicitly. Had there
> been a 'final' keyword in 1995, every STL container would have been final.
>
> Mark Ruzon
Thanks for pointing me about that. I am well aware about the fact, and
had a long discussion in cpp news group, and finally thought to have a
private inheritance rather than composition :)
Here is the link.
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/303a560a8e0c040e/103662450d71ef83?lnk=gst&q=abir&rnum=2#103662450d71ef83
Just for information , in this thread someone asked about the status of
the boost circular_buffer library. It also has a container called
circular_buffer_space_optimized which privately inherit from
circular_buffer (a decorator class ) .
  I really stl container to be final, AND really dislike stl container
to be polymorphic (I am not sure anyone uses it in that way, if they do,
they are BAD persons ! ). Thus it SAFE to have a non-polymorphic
derivation of stl container.

and thanks again

-- 
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