Click here to Skip to main content
15,923,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to set the text of a CEdit to include a newline? Pin
Atom19-Oct-05 8:15
Atom19-Oct-05 8:15 
AnswerRe: How to set the text of a CEdit to include a newline? Pin
David Crow19-Oct-05 9:10
David Crow19-Oct-05 9:10 
AnswerRe: How to set the text of a CEdit to include a newline? Pin
Ghasrfakhri19-Oct-05 9:15
Ghasrfakhri19-Oct-05 9:15 
GeneralRe: How to set the text of a CEdit to include a newline? Pin
David Crow19-Oct-05 10:06
David Crow19-Oct-05 10:06 
QuestionPreventing the resizing of a window Pin
Dilpo19-Oct-05 7:13
Dilpo19-Oct-05 7:13 
AnswerRe: Preventing the resizing of a window Pin
Maximilien19-Oct-05 7:34
Maximilien19-Oct-05 7:34 
GeneralRe: Preventing the resizing of a window Pin
Dilpo19-Oct-05 7:36
Dilpo19-Oct-05 7:36 
QuestionTransparent temporaries..? Pin
Bob Stanneveld19-Oct-05 7:07
Bob Stanneveld19-Oct-05 7:07 
Hello,

I have the following problem. I want to create a temporary object that is transparent to the caller of the function which creates the temporary. We all know that a temporary object is created on the stack for objects returned by value from a function.

I wan't to use this property of the temporary to create a locking / unlocking mechanism for an object. See the following code for details
// this class will be used by the user of the API
// In the actual code it will be a template parameter.
class CArbitraryClass
{
public:
    void DoFoo() {}
};

// this is the wrapper that the user uses to store CArbitraryClass objects
class CWrapperClass
{
public:
    // will return a temporary object which the user doesn't know or sees
    CInvisibleTemporary operator->() 
    {
	return CInvisibleTemporary::CInvisibleTemporary();
    }
};

// this object is the 'invisible' temporary. It should pass on the 
// stored object (CArbitraryClass). The user should not have to 
// call any extra functions for it.
class CInvisibleTemporary
{
public:
    CArbitraryClass& operator->() { return m_ArbitraryObject; }

private:
    CArbitraryClass m_ArbitraryObject;
};


So the code should look like the following statements:
CWrapperClass Wrapper;<br />
Wrapper->DoFoo();


But it looks like:
CWrapperClass Wrapper;<br />
Wrapper.operator ->().operator ->().DoFoo();


Am I trying to do something impossible?

Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
AnswerRe: Transparent temporaries..? Pin
BadKarma19-Oct-05 9:08
BadKarma19-Oct-05 9:08 
GeneralRe: Transparent temporaries..? Pin
Bob Stanneveld19-Oct-05 10:11
Bob Stanneveld19-Oct-05 10:11 
GeneralRe: Transparent temporaries..? Pin
BadKarma19-Oct-05 20:55
BadKarma19-Oct-05 20:55 
GeneralRe: Transparent temporaries..? Pin
Bob Stanneveld20-Oct-05 0:56
Bob Stanneveld20-Oct-05 0:56 
AnswerRe: Transparent temporaries..? Pin
BadKarma19-Oct-05 23:00
BadKarma19-Oct-05 23:00 
Questionhow to use a class to be a utility class of another class? Pin
knightz10119-Oct-05 6:29
knightz10119-Oct-05 6:29 
AnswerRe: how to use a class to be a utility class of another class? Pin
Maximilien19-Oct-05 6:50
Maximilien19-Oct-05 6:50 
AnswerRe: how to use a class to be a utility class of another class? Pin
Bob Stanneveld19-Oct-05 8:12
Bob Stanneveld19-Oct-05 8:12 
QuestionLooking for scheduling control (Outlook2003 like) Pin
TheDen19-Oct-05 5:32
TheDen19-Oct-05 5:32 
AnswerRe: Looking for scheduling control (Outlook2003 like) Pin
S Douglas20-Oct-05 0:13
professionalS Douglas20-Oct-05 0:13 
QuestionHow to determine hard drives? Pin
wasife19-Oct-05 4:28
wasife19-Oct-05 4:28 
AnswerRe: How to determine hard drives? Pin
David Crow19-Oct-05 4:40
David Crow19-Oct-05 4:40 
AnswerRe: How to determine hard drives? Pin
Anehl19-Oct-05 4:44
Anehl19-Oct-05 4:44 
QuestionSoundcard VU Meter Pin
69 Bay19-Oct-05 2:24
69 Bay19-Oct-05 2:24 
Questionapi subversion Pin
Anehl19-Oct-05 1:45
Anehl19-Oct-05 1:45 
QuestionRe: api subversion Pin
David Crow19-Oct-05 3:15
David Crow19-Oct-05 3:15 
AnswerRe: api subversion Pin
Anehl19-Oct-05 3:36
Anehl19-Oct-05 3:36 

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.