c++ 模板


template <typename T>
struct a{
T * ptr;

};


int main(){
a<int> b;
}

编译器会展开为


template <typename T>
struct a{
T * ptr;

};


#ifdef INSIGHTS_USE_TEMPLATE
template<>
struct a<int>
{
int * ptr;
// inline a() noexcept = default;
};

#endif

 

int main()
{
a<int> b = a<int>();
}

 

posted @ 2020-12-22 14:45  you_magic  阅读(85)  评论(0编辑  收藏  举报