1

Try a partial specialization with multiple parameters. Sounds like

template <class T, int E=0>
class Info
{
public:
  Info& operator=(double rhs);
  T data;
};


template<int E> Info<std::string, E> &Info<std::string, E>::operator=(double rhs) {
    data = rhs;
    return *this;
}

But cannot compile and get

error: invalid use of incomplete type 'class
info<std::__cxx11::basic_string<char>, E>'  template<int E>
Info<std::string, E> &Info<std::string, E>::operator=(double rhs)...

Update
It seems that it is not possible to do partial spec. with multiple parameters (optional or not...) Am I wrong ?

Stef
  • 3,691
  • 6
  • 43
  • 58
  • in ur specialization, u write template<>, since the type is clear from the rest – jonas_toth Jan 06 '17 at 22:19
  • 1
    You cannot partial specialize a function/method. – Jarod42 Jan 06 '17 at 22:19
  • 1
    [Here](http://coliru.stacked-crooked.com/a/99387ed89c73bc7e) is an example of how you could partially specialize the class to then in turn have a specialized member function. – wally Jan 06 '17 at 22:57

0 Answers0