Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/135.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 从boost::ptr_vector获取模板参数_C++_Boost_Ptr Vector - Fatal编程技术网

C++ 从boost::ptr_vector获取模板参数

C++ 从boost::ptr_vector获取模板参数,c++,boost,ptr-vector,C++,Boost,Ptr Vector,从boost::ptr_vector我试图得到T,但是boost::ptr_vector::value_type似乎是T*。如何获取T 看一下医生,我发现: typedef T* value_type; typedef T& reference; typedef const T&

boost::ptr_vector
我试图得到
T
,但是
boost::ptr_vector::value_type
似乎是
T*
。如何获取
T

看一下医生,我发现:

typedef  T*                                           value_type;
typedef  T&                                           reference;
typedef  const T&                                     const_reference;

这些都没有帮助…

如果你能使用C++11,on
value\u-type
应该可以完成这项工作。

如果你能使用C++11,on
value\u-type
应该完成这项工作。

因为你使用的是Boost,你可以使用它来获取指向的类型

boost::remove_pointer<boost::ptr_vector<T>::value_type>::type
boost::删除\指针::类型
将计算为
T


如果您可以使用C++11功能,那么可以使用与Boost版本相同的方式使用
std::remove_pointer

因为您使用的是Boost,所以可以使用来获取指向的类型

boost::remove_pointer<boost::ptr_vector<T>::value_type>::type
boost::删除\指针::类型
将计算为
T


如果你可以使用C++11特性,你可以使用与Boost版本相同的方式使用
std::remove_pointer

有一个Boost::remove_pointer,你可以保证他在使用Boost时拥有它,你自己编写也很简单。有一个Boost::remove_pointer,你可以保证他在使用Boost时拥有它,你自己写也没什么大不了的。