enable_if on operator type()

How can I set up SFINAE using enable_if on method like struct foo { template<class T> operator T() { return T(1); } }; I want the operator T() to be ther only if T is arithemtic for example. TIA -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35

Joel Falcou wrote:
How can I set up SFINAE using enable_if on method like
struct foo { template<class T> operator T() { return T(1); } };
I want the operator T() to be ther only if T is arithemtic for example.
You can't do that. There is no work-around. -- Eric Niebler BoostPro Computing http://www.boostpro.com

On Sun, Nov 23, 2008 at 16:30, Joel Falcou
How can I set up SFINAE using enable_if on method like
struct foo { template<class T> operator T() { return T(1); } };
I want the operator T() to be there only if T is arithemtic for example.
"There does not seem to be a way to specify an enabler for a conversion operator. Converting constructors, however, can have enablers as extra default arguments. " ~ http://www.boost.org/doc/libs/1_37_0/libs/utility/enable_if.html
participants (3)
-
Eric Niebler
-
Joel Falcou
-
Scott McMurray