How do I declare template function outside the class declaration

后端 未结 2 1076
臣服心动
臣服心动 2020-12-20 00:19
#include 
#include  
#include 

template 
class A
{
public:

    typedef typename std::vector

        
2条回答
  •  鱼传尺愫
    2020-12-20 00:39

    The answer of Naveen is correct, I can add a suggestion: I use extensively typedefs and I'm waiting template typedef and "true type definition" typedef.

    template 
    class A
    {
    public:
        typedef typename std::vector >::iterator iterator;
        typedef std::pair MyPair;
        MyPair foo();
    };
    
    template 
    typename A::MyPair A::foo()
    {
        iterator aIter;
        return MyPair(aIter ,false);
    }
    

提交回复
热议问题