Click here to Skip to main content
15,914,221 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Tutorial Recommendations Pin
Michael P Butler5-Dec-03 8:44
Michael P Butler5-Dec-03 8:44 
GeneralRe: Tutorial Recommendations Pin
Roger Wright5-Dec-03 9:03
professionalRoger Wright5-Dec-03 9:03 
GeneralRe: Tutorial Recommendations Pin
Michael P Butler5-Dec-03 9:15
Michael P Butler5-Dec-03 9:15 
GeneralRe: Tutorial Recommendations Pin
Roger Wright5-Dec-03 10:12
professionalRoger Wright5-Dec-03 10:12 
GeneralRe: Tutorial Recommendations Pin
Jörgen Sigvardsson5-Dec-03 14:04
Jörgen Sigvardsson5-Dec-03 14:04 
Questionwait methods!!!? Pin
mitil203904823045-Dec-03 6:55
mitil203904823045-Dec-03 6:55 
AnswerRe: wait methods!!!? Pin
Joe Woodbury5-Dec-03 20:51
professionalJoe Woodbury5-Dec-03 20:51 
GeneralFunction Question Pin
Nitron5-Dec-03 6:36
Nitron5-Dec-03 6:36 
I want to write a function that will have a different return type depending on the state of the class. i.e. - something like this for my header file:

if(this->SomeProperty & CHECK_PROP)
   CFoo& operator()(const CClass&);
else
   CBar& operator()(const CClass&);


I'm thinking templates, but when I tried this:

template <typename T> T& operator()(const CClass&)
{
   if(this->SomeProperty & CHECK_PROP)
      return m_foo;
   else
      return m_bar;
}

I would do: (knowing CHECK_PROP is set)
foo = testClass(m_class);


and that would generate:
<br />
error C2783: 'T &CTestClass::operator ()(const CClass&)' : could not deduce template argument for 'T'<br />


Any ideas how I could accomplish this without writing two seperate functions.
(which I tried, but you cannot have functions with the same signature that differ only by return type Cry | :(( )

- Nitron


"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
GeneralRe: Function Question Pin
Ivor S. Sargoytchev5-Dec-03 9:01
Ivor S. Sargoytchev5-Dec-03 9:01 
GeneralStartbar Message Monitoring Pin
Zero_divide_15-Dec-03 6:15
Zero_divide_15-Dec-03 6:15 
QuestionDynamic compact/extended toolbar? Pin
johannks5-Dec-03 5:09
johannks5-Dec-03 5:09 
AnswerRe: Dynamic compact/extended toolbar? Pin
Roger Allen5-Dec-03 5:16
Roger Allen5-Dec-03 5:16 
AnswerRe: Dynamic compact/extended toolbar? Pin
Roger Allen5-Dec-03 5:21
Roger Allen5-Dec-03 5:21 
GeneralRe: Dynamic compact/extended toolbar? Pin
johannks5-Dec-03 5:48
johannks5-Dec-03 5:48 
GeneralRe: Dynamic compact/extended toolbar? Pin
johannks5-Dec-03 6:10
johannks5-Dec-03 6:10 
GeneralCTabCtrl is hiding my static text Pin
SteveLoGalbo5-Dec-03 4:26
SteveLoGalbo5-Dec-03 4:26 
Question: MFC articles/demos/srcs on DVD or CD? Pin
ns5-Dec-03 4:03
ns5-Dec-03 4:03 
AnswerRe: : MFC articles/demos/srcs on DVD or CD? Pin
RChin5-Dec-03 5:18
RChin5-Dec-03 5:18 
AnswerRe: : MFC articles/demos/srcs on DVD or CD? Pin
Ravi Bhavnani5-Dec-03 6:39
professionalRavi Bhavnani5-Dec-03 6:39 
GeneralRe: : MFC articles/demos/srcs on DVD or CD? Pin
ns5-Dec-03 7:48
ns5-Dec-03 7:48 
GeneralTabCtrl + Windows XP-Style Pin
mortal5-Dec-03 3:51
mortal5-Dec-03 3:51 
GeneralRe: TabCtrl + Windows XP-Style Pin
Joel Lucsy5-Dec-03 9:21
Joel Lucsy5-Dec-03 9:21 
GeneralRe: TabCtrl + Windows XP-Style Pin
mortal5-Dec-03 20:01
mortal5-Dec-03 20:01 
GeneralRe: using classes in different directory Pin
Maximilien5-Dec-03 3:21
Maximilien5-Dec-03 3:21 
GeneralRe: using classes in different directory Pin
Anonymous5-Dec-03 4:36
Anonymous5-Dec-03 4: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.