#include <iostream>
using namespace std;
template <typename T>
class TestClass
{
public:
TestClass() = default;
~TestClass() = default;
TestClass(T value) : x(value){}
T get_value()
{
return x;
}
private:
T x = 1;
};
template <typename T, template <typename> class CONT = TestClass>
class DemoClass
{
public:
DemoClass() = default;
DemoClass(TestClass<T> &value) : m_value(value){}
public:
TestClass<T> m_value;
};
int main()
{
TestClass<int> demo_1(2);
DemoClass<int> demo(demo_1);
cout << demo.m_value.get_value() << endl;
return 0;
}
template template parameter2
最新推荐文章于 2024-05-23 20:41:19 发布