I am having a design problem with my code. I want to be able to an std::map with a key value pair of pcl::PointCloud and LidarFile(my own created class), but that requires the < operator to be overloaded since std::map uses comparisons, OR the std::less function template overloaded. The code relating to pcl::PointCloud is in a separate translation unit, and I would rather not modify it, but in order to specify a template specialization for pcl::PointCloud it seems like I have to. So how do I specify the < operator for pcl::PointCloud if it is in a separate translation unit because the error I get now? I am getting both the error
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base:63:21: error:
invalid operands to binary expression ('const
pcl::PointCloud<pcl::PointXYZRGB>' and 'const
pcl::PointCloud<pcl::PointXYZRGB>')
{return __x < __y;}
and I assume this is because I need to overload the < operator and also get this error:
/Users/wfehrnstrom/Demeter/Map.cpp:3:21: error: explicit specialization of
'std::__1::less<pcl::PointCloud<pcl::PointXYZRGB> >' after instantiation
template<> struct less<pcl::PointCloud<pcl::PointXYZRGB> >{
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could anyone guide me on correct design principle in this situation or possibly correct any misguided assumptions I have in this situation? I really appreciate it.