【发布时间】:2012-03-24 04:22:19
【问题描述】:
我想问一下 C++ 中的 typedef 变量
好的,现在我正在使用 PCL,我想将代码分成 .h 和 .cpp
这是我的 .h 文件
template <typename PointType>
class OpenNIViewer
{
public:
typedef pcl::PointCloud<PointType> Cloud;
typedef typename Cloud::ConstPtr CloudConstPtr;
...
...
CloudConstPtr getLatestCloud ();
...
...
};
然后在其他.cpp文件上定义getLatestCloud()
template <typename PointType>
CloudConstPtr OpenNIViewer<PointType>::getLatestCloud ()
{
...
}
然后我收到 C4430 错误,因为它无法识别返回类型 CloudConstPtr
抱歉这个愚蠢的问题:D
【问题讨论】:
标签: c++ templates typedef typename