|
Boost Users : |
Subject: [Boost-users] enable_if catch all?
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-07-18 13:05:56
Supposing I have 4 or 5 mutually exclusive overloads of a function
using enable_if as a function parameter with a default argument, is
there any way for me to provide an additional version of this function
that handles every other case, without manually combining all the
previous cases and using another enable_if?
For example:
template<class T>
void foo(typename enable_if<condition1>::type* dummy=0) {}
template<class T>
void foo(typename enable_if<condition2>::type* dummy=0) {}
template<class T>
void foo(typename enable_if<condition3>::type* dummy=0) {}
template<class T>
void foo(typename enable_if<condition4>::type* dummy=0) {}
template<class T>
void foo()
{
//default instantiation that gets invoked if and only if all of the
other overloads fail
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net