Re: Question about programming techniques


> STL forbids mixed-type containers. That, IMHO, disqualifies it from
> consideration for serious projects.

   How you believe it may be possible to store mixed-type containers?
STL store objects from templates. When you store, say, a vector of < T >, all
objects are stored in memory in sequence, not by pointers. So all objects
must be of the same type and size.
But ok, in general, when you need polymorphism, say, to store some objects
that are similar by all operations, that means that you may use base class
and virtual functions.
Example: if you use GTK--, you may create the vector of < Gtk_Widget * > (
vector of pointers ) and store there avery kind of widgets. Sure, you can't
store Widgets in vector by value. If you mean this when you speak about
restrictions, ok, i agree.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]