arennuit
arennuit

Reputation: 927

Forward declaring a template's member typedef

I use a library (which I cannot modify) and that declares a PointCloud template that includes a Ptr typedef

namespace pcl
{
    template <typename PointT>
    class PCL_EXPORTS PointCloud
    {
        ...
        typedef boost::shared_ptr<PointCloud<PointT> > Ptr;
    }
}

Now, I need to forward declare Ptr and I have no idea how to. I have done

namespace pcl
{
    class PointXYZ;
    template<class pointT> class PointCloud;
}

but I am stuck here and whatever I do, I do not seem to be able to forward declare the Ptr typedef.

Any idea?

----------EDIT----------

The reason why I need this forward declaration is that I need to declare a function into a header of my own. And I am expecting this function to take a PointCloud< PointXYZ >::Ptr as argument, because the PointCloud I want to feed into the function is stored into a PointCloud< PointXYZ >::Ptr.

Upvotes: 0

Views: 300

Answers (1)

Yakk - Adam Nevraumont
Yakk - Adam Nevraumont

Reputation: 275385

Typedefs are aliases for types. They are not types themselves, if that makes sense.

namespace pcl
{
  class PointXYZ;
  template<class pointT> class PointCloud;
}
template<class T>
using foo = boost::shared_ptr<pcl::PointCloud<T>>;

foo<X> is the same type as pcl::PointCloud<T>::Ptr.

Upvotes: 2

Related Questions