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

C / C++ / MFC

 
AnswerRe: Get text from the focused control in another window Pin
nc3b23-Jan-09 6:14
nc3b23-Jan-09 6:14 
GeneralRe: Get text from the focused control in another window Pin
David Crow23-Jan-09 6:21
David Crow23-Jan-09 6:21 
GeneralRe: Get text from the focused control in another window Pin
nc3b23-Jan-09 6:24
nc3b23-Jan-09 6:24 
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 
A few questions:
  1. If I understand you correctly, CheckType is returning true, but you expected false?
  2. What compiler (& version) are you using?


I've just tried your code with g++ 4.0.1 and it gives the results I'd expect. I added some code to print out type names:

template<class T> bool CheckType(boost::shared_ptr<Base> pBase)
{
   std::cout << typeid(T).name() << std::endl;
	T* pTemplate = NULL;  //Why is pTemplate Base* and not Derived1* when passing a Derived1 to template parameter?
	Base* pBaseRaw = pBase.get();
   std::cout << typeid(pBaseRaw).name() << std::endl;
	if(typeid(pBaseRaw) == typeid(pTemplate))
	{
		return true;
	}

	return false;
}
. I also printed out the result of CheckType and got these results:

8Derived1
P4Base
0
8Derived2
P4Base
0


So - the template parameter is Derived, the parameter is a pointer to Base, CheckType is returning false. I'm suspecting that the compiler you're using isn't fully standard compliant if it does something different?
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 
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 

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.