.. _program_listing_file_include_rcpputils_pointer_traits.hpp: Program Listing for File pointer_traits.hpp =========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/rcpputils/pointer_traits.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2019 Open Source Robotics Foundation, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef RCPPUTILS__POINTER_TRAITS_HPP_ #define RCPPUTILS__POINTER_TRAITS_HPP_ #include #include namespace rcpputils { namespace details { template struct is_smart_pointer_helper : std::false_type {}; template struct is_smart_pointer_helper>: std::true_type {}; template struct is_smart_pointer_helper>: std::true_type {}; template struct is_smart_pointer : is_smart_pointer_helper::type> {}; template< class T, bool is_smart_pointer > struct remove_pointer { using type = typename std::remove_pointer::type; }; template struct remove_pointer { using type = typename std::remove_pointer< decltype(std::declval::type>().get())>::type; }; } // namespace details template struct is_pointer { static constexpr bool value = std::is_pointer::type>::value || details::is_smart_pointer::type>::value; }; template struct remove_pointer { using type = typename details::remove_pointer< typename std::remove_reference::type, details::is_smart_pointer::value>::type; }; } // namespace rcpputils #endif // RCPPUTILS__POINTER_TRAITS_HPP_