I was trying my hand on a template class and i am getting a
compilation error
error C2146: syntax error : missing ';' before identifier
'isOptimizedImp lAvailable'. Any pointers would be of great help.
Here is my code
#include <iostream>
using namespace std;
template<typena me T>
class foo_traits
{
public:
static bool customImpl;
};
template<>
class foo_traits<int>
{
public:
static bool customImpl;
};
template<>
class foo_traits<char >
{
public:
static bool customImpl;
};
bool foo_traits<char >::customImpl = false;
bool foo_traits<int> ::customImpl = true;
template<typena me T>
class foo
{
public:
typename foo_traits<T>:: customImpl isOptimizedImpl Available()
{
return foo_traits<T>:: customImpl;
}
};
int main()
{
foo<intf;
}
compilation error
error C2146: syntax error : missing ';' before identifier
'isOptimizedImp lAvailable'. Any pointers would be of great help.
Here is my code
#include <iostream>
using namespace std;
template<typena me T>
class foo_traits
{
public:
static bool customImpl;
};
template<>
class foo_traits<int>
{
public:
static bool customImpl;
};
template<>
class foo_traits<char >
{
public:
static bool customImpl;
};
bool foo_traits<char >::customImpl = false;
bool foo_traits<int> ::customImpl = true;
template<typena me T>
class foo
{
public:
typename foo_traits<T>:: customImpl isOptimizedImpl Available()
{
return foo_traits<T>:: customImpl;
}
};
int main()
{
foo<intf;
}
Comment