|
nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
|
#include <qos.hpp>
Public Types | |
| typedef F | type |
Is this argument a QoS profile rather than a callback?
The refusing create_service(name, F, qos) overload on rclcpp::Node must not swallow create_service<S>("name", rclcpp::ServicesQoS()). Deducing F is an exact match while binding const rclcpp::QoS& needs a derived-to-base conversion, so without this guard the callback template WINS and a perfectly good poll-style call fails with the shared_ptr-callback diagnostic — a refusal firing on something it does not describe, which is worse than no refusal. Caught by the positive probe on its first compile. Written WITHOUT <type_traits>, and the two failures that forced it are different failures:
__has_include(<type_traits>) is TRUE and the header is INCOMPLETE – enable_if and is_convertible are there, is_base_of and decay are not. __has_include answers "does the
header exist", which is the wrong question for a header a freestanding toolchain ships hollowed out. (Issue 0112's class; step A verified against a SYNTHESISED minimal libcpp that happened to be more complete than the real one, so the lane stayed green.)NROS_CPP_STD instead fixed Zephyr and broke the freestanding-syntax lane, because the two predicates do not partition the lanes the way the names suggest. The rclcpp:: block in nros.hpp is NOT behind NROS_CPP_STD – step A declared it unconditionally, and it hands out std::shared_ptr and std::string – so the freestanding lane compiles rclcpp::Node against a SYNTHESISED minimal libcpp while defining no opt-in at all. There the header exists and the macro does not; on Zephyr the macro is available and the header is hollow. Neither predicate is true in both lanes.So the predicate depends on neither: a derived-to-base pointer conversion under overload resolution answers is_base_of with nothing but the core language, and the partial specialisations answer decay for every form a by-value template parameter can take.