Click here to Skip to main content
15,897,226 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Get text from the focused control in another window Pin
Rajkumar R23-Jan-09 8:08
Rajkumar R23-Jan-09 8:08 
GeneralRe: Get text from the focused control in another window Pin
nc3b23-Jan-09 8:10
nc3b23-Jan-09 8:10 
AnswerRe: Get text from the focused control in another window Pin
Code-o-mat23-Jan-09 6:12
Code-o-mat23-Jan-09 6:12 
QuestionTemplate parameter interpreted as base, not derived Pin
Member 260377223-Jan-09 4:59
Member 260377223-Jan-09 4:59 
AnswerRe: Template parameter interpreted as base, not derived Pin
Stuart Dootson23-Jan-09 6:40
professionalStuart Dootson23-Jan-09 6:40 
GeneralRe: Template parameter interpreted as base, not derived Pin
Member 260377223-Jan-09 7:12
Member 260377223-Jan-09 7:12 
GeneralRe: Template parameter interpreted as base, not derived Pin
Stuart Dootson23-Jan-09 8:16
professionalStuart Dootson23-Jan-09 8:16 
AnswerRe: Template parameter interpreted as base, not derived [modified] Pin
Rajkumar R23-Jan-09 7:02
Rajkumar R23-Jan-09 7:02 
Member 2603772 wrote:
T* pTemplate = NULL; //Why is pTemplate Base* and not Derived1* when passing a Derived1 to template parameter?


nope, you confused with the result, check by printing std::cout << typeid(pTemplate).name()

I think you expected the result as true and you got false (bIsDerived = true you expected, as the pointer you passed is derived).

to get what inside the pointer you can dereference it say typeid(*pBaseRaw)

so your code can be,

template<class T> bool CheckType(boost::shared_ptr<Base> pBase)
{	
	Base* pBaseRaw = pBase.get();
	<big>if(typeid(*pBaseRaw) == typeid(T))</big>	{		
		return true;	
	}	
	return false;
}


modified on Friday, January 23, 2009 1:13 PM

GeneralRe: Template parameter interpreted as base, not derived Pin
Member 260377223-Jan-09 7:14
Member 260377223-Jan-09 7:14 
QuestionCMFCMenuBar menu manipulation problem. Pin
oleg6323-Jan-09 4:39
professionaloleg6323-Jan-09 4:39 
AnswerRe: CMFCMenuBar menu manipulation problem. Pin
Shashikant_200612-Feb-09 23:53
Shashikant_200612-Feb-09 23:53 
GeneralRe: CMFCMenuBar menu manipulation problem. Pin
oleg6326-Feb-09 5:33
professionaloleg6326-Feb-09 5:33 
GeneralRe: CMFCMenuBar menu manipulation problem. Pin
neuroscript30-Jan-10 13:18
neuroscript30-Jan-10 13:18 
QuestionFile&gt;New. Window Resizes? Pin
theAce8923-Jan-09 4:16
theAce8923-Jan-09 4:16 
AnswerRe: File&gt;New. Window Resizes? Pin
Randor 23-Jan-09 7:04
professional Randor 23-Jan-09 7:04 
GeneralRe: File&gt;New. Window Resizes? Pin
theAce8929-Jan-09 11:07
theAce8929-Jan-09 11:07 
QuestionGet List of applications only Pin
vikrant kpr23-Jan-09 1:19
vikrant kpr23-Jan-09 1:19 
AnswerRe: Get List of applications only Pin
Nishad S23-Jan-09 1:49
Nishad S23-Jan-09 1:49 
AnswerRe: Get List of applications only Pin
Sarath C23-Jan-09 1:57
Sarath C23-Jan-09 1:57 
QuestionHow to change size of dialog box @ run time? Pin
sam_psycho23-Jan-09 0:50
sam_psycho23-Jan-09 0:50 
AnswerRe: How to change size of dialog box @ run time? Pin
Code-o-mat23-Jan-09 0:52
Code-o-mat23-Jan-09 0:52 
AnswerRe: How to change size of dialog box @ run time? Pin
Cedric Moonen23-Jan-09 0:54
Cedric Moonen23-Jan-09 0:54 
GeneralRe: How to change size of dialog box @ run time? Pin
sam_psycho23-Jan-09 1:02
sam_psycho23-Jan-09 1:02 
QuestionCEdit SetPasswordChar SetFont [modified] Pin
Taulie22-Jan-09 23:07
Taulie22-Jan-09 23:07 
AnswerRe: CEdit SetPasswordChar SetFont Pin
Code-o-mat23-Jan-09 0:00
Code-o-mat23-Jan-09 0:00 

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.