Click here to Skip to main content
15,905,875 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: visual c++ Pin
Eytukan1-Mar-09 6:33
Eytukan1-Mar-09 6:33 
GeneralRe: visual c++ Pin
Hamid_RT1-Mar-09 4:28
Hamid_RT1-Mar-09 4:28 
AnswerRe: visual c++ Pin
Jonathan Davies28-Feb-09 12:54
Jonathan Davies28-Feb-09 12:54 
QuestionFlashing Toolbar Buttons Pin
softwaremonkey28-Feb-09 7:41
softwaremonkey28-Feb-09 7:41 
AnswerRe: Flashing Toolbar Buttons Pin
Code-o-mat28-Feb-09 7:51
Code-o-mat28-Feb-09 7:51 
GeneralRe: Flashing Toolbar Buttons Pin
softwaremonkey1-Mar-09 6:16
softwaremonkey1-Mar-09 6:16 
GeneralRe: Flashing Toolbar Buttons Pin
Code-o-mat1-Mar-09 6:57
Code-o-mat1-Mar-09 6:57 
QuestionMethod template in a class template [compiling error, help] [modified] Pin
jim258kelly28-Feb-09 6:08
jim258kelly28-Feb-09 6:08 
The code below produces the following compiling error:

STS_OP_temp_test.cpp: In constructor 'STS_OP_temp_test<U>::STS_OP_temp_test()':
STS_OP_temp_test.cpp:66: error: expected primary-expression before 'int'
STS_OP_temp_test.cpp:66: error: expected `;' before 'int'

I take the error to mean that the compiler can't resolve "cwtm.templateMethod". Either it doesn't think "cwtm" is defined, or it doesn't think cwtm has a method called "templateMethod".

If you don't quite understand the class template stuff happening here, go to this site:
http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/template_template_arguments.htm

But that site doesn't solve my problem.

Thanks for your help.


#ifndef STS_OP_temp_test_HPP
#define STS_OP_temp_test_HPP

#include <typeinfo>
#include <iostream>
#include <string>

//------------------------------------------------------------------------------
template <typename T = int>
class Class_with_template_method
{
public:


//--------------------------------------------------------------------------
Class_with_template_method()
{}


//--------------------------------------------------------------------------
template <typename P>
void templateMethod()
{
std::cout << "Method template is of type: " << typeid(P).name() << std::endl;
}

};


//------------------------------------------------------------------------------
template <template<class T> class U>
class STS_OP_temp_test
{
public:


//--------------------------------------------------------------------------
STS_OP_temp_test()
{
cwtm.templateMethod<int>(); // Line 66 compiling error!!!

real_cwtm.templateMethod<int>();

}

U<int> cwtm;

Class_with_template_method<> real_cwtm;

};

int main()
{

STS_OP_temp_test<Class_with_template_method> C();//*/

return (1);
}
#endif

<div class="ForumMod">modified on Saturday, February 28, 2009 1:21 PM</div>
NewsRe: Method template in a class template [compiling error, help] [modified] Pin
jim258kelly28-Feb-09 7:30
jim258kelly28-Feb-09 7:30 
AnswerRe: Method template in a class template [compiling error, help] Pin
Stuart Dootson28-Feb-09 9:37
professionalStuart Dootson28-Feb-09 9:37 
GeneralRe: Method template in a class template [compiling error, help] Pin
jim258kelly28-Feb-09 10:34
jim258kelly28-Feb-09 10:34 
GeneralRe: Method template in a class template [compiling error, help] Pin
Stuart Dootson28-Feb-09 11:31
professionalStuart Dootson28-Feb-09 11:31 
QuestionString table Updation Pin
Alex@9C28-Feb-09 5:39
Alex@9C28-Feb-09 5:39 
AnswerRe: String table Updation Pin
Code-o-mat28-Feb-09 7:37
Code-o-mat28-Feb-09 7:37 
QuestionPicture Control Pin
daavena28-Feb-09 5:36
daavena28-Feb-09 5:36 
AnswerRe: Picture Control Pin
Code-o-mat28-Feb-09 7:42
Code-o-mat28-Feb-09 7:42 
GeneralRe: Picture Control Pin
daavena28-Feb-09 7:49
daavena28-Feb-09 7:49 
GeneralRe: Picture Control Pin
Code-o-mat28-Feb-09 7:52
Code-o-mat28-Feb-09 7:52 
GeneralRe: Picture Control Pin
daavena28-Feb-09 8:19
daavena28-Feb-09 8:19 
GeneralRe: Picture Control [modified] Pin
Code-o-mat28-Feb-09 8:31
Code-o-mat28-Feb-09 8:31 
GeneralRe: Picture Control Pin
daavena28-Feb-09 9:09
daavena28-Feb-09 9:09 
GeneralRe: Picture Control [modified] Pin
Code-o-mat28-Feb-09 9:22
Code-o-mat28-Feb-09 9:22 
GeneralRe: Picture Control Pin
daavena28-Feb-09 9:46
daavena28-Feb-09 9:46 
QuestionLarge number generator in c++ Pin
Mark Elrod28-Feb-09 5:12
Mark Elrod28-Feb-09 5:12 
AnswerRe: Large number generator in c++ Pin
Stuart Dootson28-Feb-09 9:45
professionalStuart Dootson28-Feb-09 9:45 

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.