【发布时间】:2016-05-30 14:55:57
【问题描述】:
在下面的代码中
template <typename T> struct Maybe {
T* context;
Maybe(T *context) : context{context} {} .... }
声明和声明有什么区别
Maybe(T *context) : context{context} {} .... }
和
Maybe(T *context) : context(context) {} .... }
?
这两个选项都编译和运行没有问题。
【问题讨论】:
-
在这种情况下(哈哈)它们是一样的。
标签: c++ templates constructor