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?

Yves Calaci
  • 1,019
  • 1
  • 11
  • 37

1 Answers1

0

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

template <class T, class>
void Bar::foobar() {}
bolov
  • 72,283
  • 15
  • 145
  • 224