consider this header file (validate_floats) at https://github.com/ros-visualization/rviz/blob/groovy-devel/src/rviz/validate_floats.h
basically it declares several overrides for function bool validateFloats(some type), and a templated version for the case where the type is a std::vector<T>, which calls validateFloats(T) for all the elements of the vector. These are all inline and within the rviz namespace. Then in my own cpp file, I include validate_floats.h and declare my own additional overrides: namespace rviz { bool validateFloats(const nav_msgs::Path& msg) { return validateFloats(msg.poses); } bool validateFloats(const driving_common::PathBundle& msg) { return validateFloats(msg.paths); } } where msg.poses is a std::vector<PoseStamped>, where PoseStamped is one of the types that validateFloats knows how to handle (from validate_floats.h) and msg.paths is a std::vector<nav_msgs::Path> Further in my cpp file, I call rviz::validateFloats(path_bundle_msg). I expected that this function call would call validateFloats(const driving_common::PathBundle& msg) which would in turn call the vectorized function which would call validateFloats(const nav_msgs::Path& msg) However, g++ cannot find my declaration of validateFloats(const nav_msgs::Path& msg) and tells me that it does not know how to handle this type. It lists all the candidates in validate_floats.h and complains that they do not match, but does not list my validateFloats(const nav_msgs::Path& msg) override as a candidate. this is the g++ error messages (I shortened the paths for easier reading) Note: - nav_msgs::Path is actually a typedef to nav_msgs::Path_<std::allocator<void> > - mysrc/path_bundle_display.cpp:77 corresponds to the call to validateFloats(msg.paths) In file included from mysrc/path_bundle_display.cpp:55:0: [...]rviz/validate_floats.h: In function ‘bool rviz::validateFloats(const std::vector<T>&) [with T = nav_msgs::Path_<std::allocator<void> >]’: mysrc/path_bundle_display.cpp:77:34: instantiated from here [...]rviz/validate_floats.h:159:5: error: no matching function for call to ‘validateFloats(const nav_msgs::Path_<std::allocator<void> >&)’ [...]rviz/validate_floats.h:159:5: note: candidates are: [...]rviz/validate_floats.h:49:13: note: bool rviz::validateFloats(float) [...]rviz/validate_floats.h:49:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘float’ [...]rviz/validate_floats.h:54:13: note: bool rviz::validateFloats(double) [...]rviz/validate_floats.h:54:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘double’ [...]rviz/validate_floats.h:59:13: note: bool rviz::validateFloats(const Ogre::Vector3&) [...]rviz/validate_floats.h:59:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Ogre::Vector3&’ [...]rviz/validate_floats.h:68:13: note: bool rviz::validateFloats(const Ogre::Quaternion&) [...]rviz/validate_floats.h:68:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Ogre::Quaternion&’ [...]rviz/validate_floats.h:78:13: note: bool rviz::validateFloats(const Point&) [...]rviz/validate_floats.h:78:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Point& {aka const geometry_msgs::Point_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:87:13: note: bool rviz::validateFloats(const Point32&) [...]rviz/validate_floats.h:87:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Point32& {aka const geometry_msgs::Point32_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:96:13: note: bool rviz::validateFloats(const Vector3&) [...]rviz/validate_floats.h:96:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Vector3& {aka const geometry_msgs::Vector3_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:105:13: note: bool rviz::validateFloats(const Twist&) [...]rviz/validate_floats.h:105:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Twist& {aka const geometry_msgs::Twist_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:113:13: note: bool rviz::validateFloats(const Quaternion&) [...]rviz/validate_floats.h:113:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Quaternion& {aka const geometry_msgs::Quaternion_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:123:13: note: bool rviz::validateFloats(const ColorRGBA&) [...]rviz/validate_floats.h:123:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const ColorRGBA& {aka const std_msgs::ColorRGBA_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:133:13: note: bool rviz::validateFloats(const PointStamped&) [...]rviz/validate_floats.h:133:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const PointStamped& {aka const geometry_msgs::PointStamped_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:138:13: note: bool rviz::validateFloats(const Pose&) [...]rviz/validate_floats.h:138:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const Pose& {aka const geometry_msgs::Pose_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:146:13: note: bool rviz::validateFloats(const PoseStamped&) [...]rviz/validate_floats.h:146:13: note: no known conversion for argument 1 from ‘const nav_msgs::Path_<std::allocator<void> >’ to ‘const PoseStamped& {aka const geometry_msgs::PoseStamped_<std::allocator<void> >&}’ [...]rviz/validate_floats.h:152:13: note: template<class T> bool rviz::validateFloats(const std::vector<T>&) So I am wondering what is my issue exactly and how do I proceed to solve it? I can fix using a more explicit way to validate floats, by myself providing the correct low level calls of course, but I'd like to see why I can't use this neat override technique... note that I am posting in this mailing list because I believe this is quite g++ specific rather than a feature or c++, but let me know if I'd rather post this in the c++ mailing lists instead. -- View this message in context: http://gcc.1065356.n5.nabble.com/my-overrides-cannot-be-found-by-compiler-tp929517.html Sent from the gcc - Gnu Help List mailing list archive at Nabble.com. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org https://lists.gnu.org/mailman/listinfo/help-gplusplus