Reputation: 115
I want to ask about typedef definition. I'm using pcl library and in tutorials sometimes I see the definition like this:
file.h
typedef pcl::PointXYZ PointT;
class File {...}
file.cpp
pcl::visualization::PCLVisualizer<PointT> ...
and other times they don't define the typedef into .h and they only put:
file.cpp
pcl::PointCloud<pcl::PointXYZ>
Which one is better? one is more performante? is bad style? Thanks!
Upvotes: 0
Views: 145
Reputation: 10947
There isn't any difference in performance. So, the only reason to use one above the other is the style.
Some coding rules (e.g., Linux kernel) suggest to not use typedefs, because they hide what you're really calling. However, if you know what you're doing, typedefs can save a lot of typing.
Upvotes: 1