Click here to Skip to main content
15,911,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Invalidate problem Pin
Anonymous17-Aug-02 4:12
Anonymous17-Aug-02 4:12 
GeneralRe: Invalidate problem Pin
dlhson17-Aug-02 9:09
dlhson17-Aug-02 9:09 
Questionhow to get access to accept null values through code? Pin
nss16-Aug-02 17:09
nss16-Aug-02 17:09 
AnswerRe: how to get access to accept null values through code? Pin
Todd Smith16-Aug-02 17:32
Todd Smith16-Aug-02 17:32 
GeneralRe: how to get access to accept null values through code? Pin
nss16-Aug-02 18:08
nss16-Aug-02 18:08 
GeneralRe: how to get access to accept null values through code? Pin
nss16-Aug-02 18:13
nss16-Aug-02 18:13 
GeneralA strange compiler error C2440 Pin
IFREETA16-Aug-02 13:56
IFREETA16-Aug-02 13:56 
GeneralRe: A strange compiler error C2440 Pin
Daniel Lohmann16-Aug-02 21:34
Daniel Lohmann16-Aug-02 21:34 
Only a shot in the dark (don't have my docs at hand):

I assume vector::push_back() takes a const reference to the object type (which is auto_ptr<b> in your case). An auto_ptr contains an ownership flag and if assigning auto_ptrs always the L-value takes ownership. For this the R-value (the auto_ptr you try to insert in your vector) has to be modified, because it's ownerhip flag has to be cleared. And this is not possible because it has been passed as a const reference.

The error message could be translated to:
error C2440: 'initializing' : cannot convert from 'const std::auto_ptr<_Ty>' to 'std::auto_ptr<_Ty>' with [ _Ty=b ]
which makes the problem a bit more obvious.


(BTW: Does anybody know why the the C++ standard comitee did not made the ownership flag of an auto_ptr mutable, so it could be modified even in const objects?)

--

Daniel Lohmann

http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there Big Grin | :-D )
GeneralRe: A strange compiler error C2440 Pin
Stuart Dootson17-Aug-02 0:30
professionalStuart Dootson17-Aug-02 0:30 
GeneralRe: A strange compiler error C2440 Pin
Daniel Lohmann17-Aug-02 11:27
Daniel Lohmann17-Aug-02 11:27 
GeneralRe: A strange compiler error C2440 Pin
IFREETA17-Aug-02 1:57
IFREETA17-Aug-02 1:57 
GeneralRe: A strange compiler error C2440 Pin
dlhson17-Aug-02 9:12
dlhson17-Aug-02 9:12 
GeneralNot so simple Pin
IFREETA17-Aug-02 3:28
IFREETA17-Aug-02 3:28 
GeneralRe: Not so simple Pin
Daniel Lohmann17-Aug-02 11:30
Daniel Lohmann17-Aug-02 11:30 
GeneralRe: Not so simple Pin
Stuart Dootson17-Aug-02 11:35
professionalStuart Dootson17-Aug-02 11:35 
GeneralRe: A strange compiler error C2440 Pin
Stuart Dootson17-Aug-02 21:59
professionalStuart Dootson17-Aug-02 21:59 
GeneralRe: A strange compiler error C2440 Pin
Mike Nordell17-Aug-02 23:25
Mike Nordell17-Aug-02 23:25 
GeneralNeed a help with CDialog and WM_QWERYENDSESSION Pin
Pavel Sokolov16-Aug-02 13:19
Pavel Sokolov16-Aug-02 13:19 
GeneralRe: Need a help with CDialog and WM_QWERYENDSESSION Pin
Daniel Ferguson16-Aug-02 21:05
Daniel Ferguson16-Aug-02 21:05 
GeneralRe: Need a help with CDialog and WM_QWERYENDSESSION Pin
Pavel Sokolov17-Aug-02 0:16
Pavel Sokolov17-Aug-02 0:16 
GeneralReal document in View Pin
RocardoS16-Aug-02 13:00
sussRocardoS16-Aug-02 13:00 
GeneralMFC newbie needs help with CString Pin
Raskolnikov16-Aug-02 12:42
Raskolnikov16-Aug-02 12:42 
GeneralRe: MFC newbie needs help with CString Pin
valikac16-Aug-02 13:14
valikac16-Aug-02 13:14 
GeneralRe: MFC newbie needs help with CString Pin
Christian Graus16-Aug-02 13:19
protectorChristian Graus16-Aug-02 13:19 
GeneralCString Trim Pin
Shotgun16-Aug-02 12:26
Shotgun16-Aug-02 12:26 

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.