Boost logo

Boost Users :

From: Yutaka Leon Suematsu (yutaka_at_[hidden])
Date: 2005-04-01 04:27:23


Dear booster,

I have a question related to enable_if. I would like to enable or disable
some member functions from a template class, but enable_if is -not enable-
to do it :-)

Here is the code.

template <class T>
class A
{
...
      enable_if< boost::is_arithmetic<T>, void > :: type f1()
      {
            ...
      }
};

In class A, I want to define function f1 only if the template parameter is
arithmetic. It works fine except when the parameter is not arithmetic. I
have a compile error "error C2039: 'type' : is not a member of
'boost::enable_if<Cond,T>'" (Working with VC7.1, and boost 3.12)

Thank you in advance for any suggestions and help.

Sincerely yours,

Yutaka Leon Suematsu


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