
At 23:28 2005-10-26, Gennadiy Rozental wrote:
struct people: vecperson { ///some methods only, no data ///nontrivial constructor as choir, but we still have /// sizeof(vecperson) == sizeof(people) };
I submit that people is a concrete type, with no restrictions on newing deleting, or containing.
I do not question it is valid C++. It is also an example of bad practice. people is not just a vector of person - I dare to submit they are much more. Yet we could implement model of people using some collection of persons (amoung other things). What I am trying to say is that here is a clear example of confusion of "IMPLEMENTED WITH" relationthip with "IS A". And in most cases when someine trying to inherit from collection this is the case.
OK, fix the core language so that I don't have to write the whole batch of forwarding functions, AND I get the new ones automatically when std::vector gets updated!! No??? don't wanna do that? then it ISA std::vector<> (or whatever STL collection I choose)!!
NOW if the question everyone else answered is can you do this?
vecperson* pv = new people; delete pv;
I _suspect_ that it will work just fine,
It will, but only for the definition above. As soon as you got nontrivial destructor in people I _am sure_ it won't anymore
but I'm not interested in that problem, nor was there any indication in the OP that it was a requirement.
My understanding is that making it work always was a primary goal of OP.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"