2

Lets say I have a struct declaration in code.h file

namespace CPP
{
    template<int Max>
    struct myStruct
    {
        int operator()(int s = 0) const;
        
    };
}

In code.cpp, I am required to define operator() like such

namespace CPP
{
    template<int Max>
    int myStruct<Max>::operator()(int s) const{
        return 0;
    }

} // end namespace

Currently, linker is throwing undefine reference for the above function. How should I approach it by using Explicit instantiation? I've read through a few documents and queries, but they seem to have different approaches.

LegendDemonSlayer
  • 1,677
  • 2
  • 9
  • 15

0 Answers0