samedi 29 avril 2017

C++11 - enable_if - function implementation outside of class definition

How can I implement function with template that have enable_if?

class Test
{
public:
    Test(){}
    ~Test(){}

    template<typename T, typename std::enable_if<std::is_integral<T>::value>::type>
    void do_something(T v);

    template<typename T, typename std::enable_if<std::is_floating_point<T>::value>::type>
    void do_something(T v);

};

How to implement do_something for different types outsice od class definition (i.e. in inline file)?

Aucun commentaire:

Enregistrer un commentaire