How to forward declare a template class in namespace std?

后端 未结 4 1260
渐次进展
渐次进展 2020-12-02 06:30
#ifndef __TEST__
#define __TEST__

namespace std
{
    template
    class list;
}

template
void Pop(std::list * l)
{
           


        
4条回答
  •  悲哀的现实
    2020-12-02 07:14

    there is a limited alternative you can use

    header:

    class std_int_vector;
    
    class A{
        std_int_vector* vector;
    public:
        A();
        virtual ~A();
    };
    

    cpp:

    #include "header.h"
    #include 
    class std_int_vector: public std::vectror {}
    
    A::A() : vector(new std_int_vector()) {}
    [...]
    

    not tested in real programs, so expect it to be non-perfect.

提交回复
热议问题