Agoston Bejo wrote:
Hi all, I am trying to enable only two version of a function. The caller may choose one
of the two versions by specifying a template parameter. I've got two versions
#include <iostream> #include
#include using namespace std; using namespace boost;
template
enable_if_c f(T t) { cout << 1 << endl; } template
enable_if_c f(T t) { cout << 2 << endl; } int _tmain(int argc, _TCHAR* argv[])
_tmain, _TCHAR ... what are these funny symbols? ;-)
{ f<1>(10); // ERROR f<2>(5.5); // ERROR f<3>(7); // ERROR return 0; }
I'd say enable_if is not the right tool for this situation. Try:
template<int N>
struct f_impl {
template<typename T>
static void execute(T t)
{
cout << "f_impl::execute()" << "\n";
}
};
template