1

Suppose I have the following:

// Foo.h
struct Foo {};

// Bar.h
struct Bar {
    template <typename T, typename = typename std::enable_if<std::is_base_of<Foo, T>::value>::type>
    void foobar();
};

// Bar.hpp
// ...?
void Bar::foobar() {}

How do I declare the foobar function on Bar.hpp?

Henri
  • 716
  • 7
  • 28

1 Answers1

0

The default argument must be specified just once. So do this:

template <class T, class>
void Bar::foobar() {}
bolov
  • 65,999
  • 14
  • 127
  • 202