Re: vector of pointers.
  Home FAQ Contact Sign in
comp.lang.c++ only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.c++ Profile…
 Up
Re: vector of pointers.         


Author: nickf3
Date: May 1, 2007 10:52

On May 1, 1:05 pm, "Victor Bazarov" comAcast.net> wrote:
> Dave wrote:
>> A quick question:
>
>> vector test_vec;
>> T testT;
>> test_vec.push_back(&testT);
>
>> T * testT2p = new T;
>> test_vec.push_back(testT2p);
>
>> Now at the end do I need to explicitly delete the vector (test_vec).
>
> Only the elements that were explicitly 'new'ed.
>
>> How should I make sure that the memory allocation is ok?
>
> There is no other non-implementation-specific way except to keep
> some kind of flag to distinguish between the ones you got from 'new'
> and the others. ...
Show full article (1.42Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Pointer to Pointeruw.cs.cs136 ·