Click here to Skip to main content
16,017,788 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSetup a Default Button Pin
Ian Bowler12-Oct-05 8:14
Ian Bowler12-Oct-05 8:14 
QuestionRe: Setup a Default Button Pin
David Crow12-Oct-05 9:55
David Crow12-Oct-05 9:55 
AnswerRe: Setup a Default Button Pin
Ian Bowler12-Oct-05 11:07
Ian Bowler12-Oct-05 11:07 
GeneralRe: Setup a Default Button Pin
David Crow13-Oct-05 2:55
David Crow13-Oct-05 2:55 
AnswerRe: Setup a Default Button Pin
vikas amin12-Oct-05 22:33
vikas amin12-Oct-05 22:33 
AnswerRe: Setup a Default Button Pin
ThatsAlok13-Oct-05 1:59
ThatsAlok13-Oct-05 1:59 
GeneralRe: Setup a Default Button Pin
Ian Bowler13-Oct-05 5:26
Ian Bowler13-Oct-05 5:26 
QuestionInvisible temporary Pin
Bob Stanneveld12-Oct-05 6:47
Bob Stanneveld12-Oct-05 6:47 
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 values returned by value from a function, the temporary is created on the stack until it is no longer needed.

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[^]
QuestionSerial Comms Help Please! Pin
Member 138216012-Oct-05 6:34
Member 138216012-Oct-05 6:34 
AnswerRe: Serial Comms Help Please! Pin
Rage12-Oct-05 7:12
professionalRage12-Oct-05 7:12 
Questionproblems with WinINet.h with visual studio 2003 Pin
brwoodru12-Oct-05 6:18
brwoodru12-Oct-05 6:18 
AnswerRe: problems with WinINet.h with visual studio 2003 Pin
prasad_som12-Oct-05 21:24
prasad_som12-Oct-05 21:24 
QuestionProblems Bringing Active X Control (.ocx) Into An Application Pin
johndavis12-Oct-05 6:06
johndavis12-Oct-05 6:06 
QuestionDo I always need a function that's executed by only one thread to initialize synchronization objetcs? Pin
Federico Milano12-Oct-05 5:55
Federico Milano12-Oct-05 5:55 
AnswerRe: Do I always need a function that's executed by only one thread to initialize synchronization objetcs? Pin
Rage12-Oct-05 7:05
professionalRage12-Oct-05 7:05 
GeneralRe: Do I always need a function that's executed by only one thread to initialize synchronization objetcs? Pin
Federico Milano12-Oct-05 7:38
Federico Milano12-Oct-05 7:38 
GeneralRe: Do I always need a function that's executed by only one thread to initialize synchronization objetcs? Pin
Blake V. Miller13-Oct-05 18:16
Blake V. Miller13-Oct-05 18:16 
GeneralRe: Do I always need a function that's executed by only one thread to initialize synchronization objetcs? Pin
Federico Milano14-Oct-05 2:20
Federico Milano14-Oct-05 2:20 
GeneralRe: Do I always need a function that's executed by only one thread to initialize synchronization objetcs? Pin
Blake V. Miller24-Nov-05 9:09
Blake V. Miller24-Nov-05 9:09 
QuestionExecute and retrieve data from console Pin
schemp9812-Oct-05 5:11
schemp9812-Oct-05 5:11 
QuestionRe: Execute and retrieve data from console Pin
David Crow12-Oct-05 6:22
David Crow12-Oct-05 6:22 
AnswerRe: Execute and retrieve data from console Pin
schemp9812-Oct-05 7:09
schemp9812-Oct-05 7:09 
GeneralRe: Execute and retrieve data from console Pin
Rage12-Oct-05 7:26
professionalRage12-Oct-05 7:26 
GeneralRe: Execute and retrieve data from console Pin
David Crow12-Oct-05 7:33
David Crow12-Oct-05 7:33 
QuestionGetting IP Address through WMI Pin
qrverona12-Oct-05 4:23
qrverona12-Oct-05 4:23 

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.