Click here to Skip to main content
15,921,210 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC classes in my class Pin
jmkhael26-Apr-04 6:55
jmkhael26-Apr-04 6:55 
GeneralRe: MFC classes in my class Pin
David Crow26-Apr-04 6:47
David Crow26-Apr-04 6:47 
GeneralRe: MFC classes in my class Pin
David Crow26-Apr-04 6:49
David Crow26-Apr-04 6:49 
GeneralRe: MFC classes in my class Pin
pie26-Apr-04 6:50
pie26-Apr-04 6:50 
GeneralRe: MFC classes in my class Pin
David Crow26-Apr-04 7:03
David Crow26-Apr-04 7:03 
GeneralRe: MFC classes in my class Pin
pie26-Apr-04 7:05
pie26-Apr-04 7:05 
GeneralRe: MFC classes in my class Pin
Navin26-Apr-04 6:57
Navin26-Apr-04 6:57 
GeneralRe: MFC classes in my class Pin
Paul Ranson26-Apr-04 8:11
Paul Ranson26-Apr-04 8:11 
Objects that can be stored in std:: containers must be copyable, and copies must be equivalent. This isn't the case with CBrush. Even if you arrange a copy constructor such that the object being copied to takes ownership,
test ( const test& t)
{
   f.Attach ( t.f.Detach ()) ;
}

you haven't met the 'equivalent' condition since the new object owns the Windows Brush and the old one no longer does. In your example if 't' was initialised with a valid brush after the push_back would no longer own it.

The copy constructor above won't compile because the argument 't' is const and we're trying to modify it with 'Detach', sound familiar?

In these circumstances it is appropriate to store a container of pointers and manage the destruction of the contained pointers manually.

Paul
GeneralRe: MFC classes in my class Pin
pie26-Apr-04 8:18
pie26-Apr-04 8:18 
GeneralRe: MFC classes in my class Pin
Nemanja Trifunovic26-Apr-04 8:25
Nemanja Trifunovic26-Apr-04 8:25 
GeneralPrinting problem Pin
Acetate26-Apr-04 6:22
Acetate26-Apr-04 6:22 
GeneralRe: Printing problem Pin
David Crow26-Apr-04 6:29
David Crow26-Apr-04 6:29 
GeneralRe: Printing problem Pin
Acetate26-Apr-04 6:43
Acetate26-Apr-04 6:43 
GeneralRe: Printing problem Pin
David Crow26-Apr-04 6:53
David Crow26-Apr-04 6:53 
GeneralRe: Printing problem Pin
CodeBrain26-Apr-04 21:01
CodeBrain26-Apr-04 21:01 
GeneralRe: Printing problem Pin
Acetate27-Apr-04 3:41
Acetate27-Apr-04 3:41 
GeneralRe: Printing problem Pin
CodeBrain2-May-04 1:36
CodeBrain2-May-04 1:36 
QuestionEasy encryption way in windows? Pin
richard sancenot26-Apr-04 5:56
richard sancenot26-Apr-04 5:56 
AnswerRe: Easy encryption way in windows? Pin
jmkhael26-Apr-04 6:13
jmkhael26-Apr-04 6:13 
GeneralMFC : Dialog App stoping without reason !! Pin
haust26-Apr-04 5:44
haust26-Apr-04 5:44 
GeneralRe: MFC : Dialog App stoping without reason !! Pin
toxcct26-Apr-04 5:49
toxcct26-Apr-04 5:49 
GeneralRe: MFC : Dialog App stoping without reason !! Pin
haust26-Apr-04 7:16
haust26-Apr-04 7:16 
GeneralRe: MFC : Dialog App stoping without reason !! Pin
Prakash Nadar26-Apr-04 6:07
Prakash Nadar26-Apr-04 6:07 
GeneralRe: MFC : Dialog App stoping without reason !! Pin
haust26-Apr-04 7:19
haust26-Apr-04 7:19 
GeneralRe: MFC : Dialog App stoping without reason !! Pin
toxcct26-Apr-04 7:32
toxcct26-Apr-04 7:32 

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.