P
Peter Koch Larsen
This question has undoubtedly come up zillions of times before, but I've not
been able to google for an answer. My problem can be reproduced as follows:
template<typename T, bool b>
struct bad
{
void f(T const& t);
};
// wanting to specialise for b = true
template<typename T> // Line 15
void bad<T,true>::f()
{
// code goes here
}
// wanting to specialise for b = false
template<typename T>
void bad<T,false>::f()
{
// code goes here
}
This does not work - I receive the following error(Microsoft Beta):
:\cpptest\cpptest.cpp(15) : error C2244: 'bad<T,b>::f' : unable to match
function definition to an existing declaration
s:\cpptest\cpptest.cpp(7) : see declaration of 'bad<T,b>::f'
What did I do wrong?
/Peter
been able to google for an answer. My problem can be reproduced as follows:
template<typename T, bool b>
struct bad
{
void f(T const& t);
};
// wanting to specialise for b = true
template<typename T> // Line 15
void bad<T,true>::f()
{
// code goes here
}
// wanting to specialise for b = false
template<typename T>
void bad<T,false>::f()
{
// code goes here
}
This does not work - I receive the following error(Microsoft Beta):
:\cpptest\cpptest.cpp(15) : error C2244: 'bad<T,b>::f' : unable to match
function definition to an existing declaration
s:\cpptest\cpptest.cpp(7) : see declaration of 'bad<T,b>::f'
What did I do wrong?
/Peter