rclcpp
rclcpp copied to clipboard
Make get_rcl_allocator a function family (not a template)
As explained in #1254, there's conceptually no way to implement RCL allocators in terms of C++ allocators. In order to fix this behavior, we have to delete the generic version of get_rcl_allocator. Since some ROS code depends on this, we need to allow users to write their own version of get_rcl_allocator for allocators that support the C-style interface (most do).
So this CL changes get_rcl_allocator from a template function into a
family of (potentially templated) functions, which allows users to add their
own overloads and rely on the "most specialized" mechanism for function
specialization to select the right one. See http://www.gotw.ca/publications/mill17.htm
for details. This also allows us to return get_rcl_default_allocator for all
specializations of std::allocator (previously, only for std::allocator
I've tried to test this by doing a full ROS compilation following the Dockerfile of the source Docker image, and all packages compile.