Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Database problem Pin
Sakhalean4-Jun-10 4:59
Sakhalean4-Jun-10 4:59 
QuestionHelp with Template Container of Pointers to any type Pin
zZDimonZz3-Jun-10 8:56
zZDimonZz3-Jun-10 8:56 
AnswerRe: Help with Template Container of Pointers to any type Pin
Code-o-mat3-Jun-10 9:23
Code-o-mat3-Jun-10 9:23 
AnswerRe: Help with Template Container of Pointers to any type Pin
Niklas L3-Jun-10 11:46
Niklas L3-Jun-10 11:46 
AnswerRe: Help with Template Container of Pointers to any type Pin
John R. Shaw3-Jun-10 12:08
John R. Shaw3-Jun-10 12:08 
GeneralRe: Help with Template Container of Pointers to any type Pin
zZDimonZz7-Jun-10 6:29
zZDimonZz7-Jun-10 6:29 
AnswerRe: Help with Template Container of Pointers to any type Pin
Stephen Hewitt3-Jun-10 13:58
Stephen Hewitt3-Jun-10 13:58 
AnswerRe: Help with Template Container of Pointers to any type Pin
Aescleal3-Jun-10 20:50
Aescleal3-Jun-10 20:50 
Why do you need the two types?

You could specify your template as:

template <typename container>
class pointer_container
{
};


and check that it really contains pointers (or something dereferenceable) in the constructor:

pointer_container()
{
    container::value_type ptr;
    *ptr;
};


then:

pointer_container<std::vector<int> > int_container; // won't compile
pointer_container<std::vector<int *> > int_ptr_container; // will compile


Now the sermon:

IF you want to maintain a collection of pointers and delete what they're pointing to when the object dies, how about using the magic of smart pointers instead?

std::vector< std::shared_ptr< my_class> > my_class_v;


or use Thorsten Ottosen's pointer containers from Boost[^].

If you're not, please disregard the second half of this message!

Cheers,

Ash
NewsBusco programadores C++ / DirectX - Motor videojuegos Pin
ThundThund3-Jun-10 8:28
ThundThund3-Jun-10 8:28 
GeneralRe: Busco programadores C++ / DirectX - Motor videojuegos Pin
loyal ginger3-Jun-10 9:42
loyal ginger3-Jun-10 9:42 
GeneralRe: Busco programadores C++ / DirectX - Motor videojuegos Pin
ThundThund3-Jun-10 9:43
ThundThund3-Jun-10 9:43 
QuestionDirectshow question Pin
godspeed1233-Jun-10 7:59
godspeed1233-Jun-10 7:59 
AnswerRe: Directshow question Pin
Hristo-Bojilov4-Jun-10 9:01
Hristo-Bojilov4-Jun-10 9:01 
QuestionVS2010 - project setup Pin
Ed SHaw3-Jun-10 0:59
Ed SHaw3-Jun-10 0:59 
AnswerRe: VS2010 - project setup Pin
«_Superman_»3-Jun-10 1:05
professional«_Superman_»3-Jun-10 1:05 
QuestionGDI leak in "Tree View" with TVS_CHECKBOXES property Pin
139135068422-Jun-10 21:57
139135068422-Jun-10 21:57 
AnswerRe: GDI leak in "Tree View" with TVS_CHECKBOXES property Pin
139135068423-Jun-10 0:24
139135068423-Jun-10 0:24 
QuestionCommandLine execution problem Pin
krishna_CP2-Jun-10 21:04
krishna_CP2-Jun-10 21:04 
AnswerRe: CommandLine execution problem Pin
Richard MacCutchan2-Jun-10 21:13
mveRichard MacCutchan2-Jun-10 21:13 
AnswerRe: CommandLine execution problem Pin
KarstenK2-Jun-10 21:32
mveKarstenK2-Jun-10 21:32 
GeneralRe: CommandLine execution problem DOS Error code 1073741819 Pin
krishna_CP2-Jun-10 22:39
krishna_CP2-Jun-10 22:39 
GeneralRe: CommandLine execution problem DOS Error code 1073741819 Pin
KarstenK2-Jun-10 22:49
mveKarstenK2-Jun-10 22:49 
QuestionLoading bitmap in Dialog in OnPaint() Pin
Anu_Bala2-Jun-10 18:00
Anu_Bala2-Jun-10 18:00 
AnswerRe: Loading bitmap in Dialog in OnPaint() Pin
Aescleal2-Jun-10 20:34
Aescleal2-Jun-10 20:34 
AnswerRe: Loading bitmap in Dialog in OnPaint() Pin
Niklas L2-Jun-10 21:03
Niklas L2-Jun-10 21:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.