This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: vector of abstract class


> 	I shouldn't be allowed to have a vector of an abstract class,
> 	should I?

Why not? Instantiating the vector template does not require creation
of a member element. If you actually try to push_back an element, or
if you initialize the vector as

  vector<S> v(10);

(with 10 empty elements), you'll get the error you expect.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]