.. _program_listing_file__tmp_ws_src_point_cloud_msg_wrapper_point_cloud_msg_wrapper_include_point_cloud_msg_wrapper_type_traits.hpp: Program Listing for File type_traits.hpp ======================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/point_cloud_msg_wrapper/point_cloud_msg_wrapper/include/point_cloud_msg_wrapper/type_traits.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2021 Apex.AI, 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 POINT_CLOUD_MSG_WRAPPER__TYPE_TRAITS_HPP_ #define POINT_CLOUD_MSG_WRAPPER__TYPE_TRAITS_HPP_ #include #include namespace point_cloud_msg_wrapper { namespace detail { // TODO(igor): this is a general trait, should it live elsewhere? template class Ref> struct is_specialization : std::false_type {}; template class Ref, typename ... Args> struct is_specialization, Ref>: std::true_type {}; // Taken from https://stackoverflow.com/a/35207812/1763680 template struct has_operator_equals_impl { template static auto test(U *)->decltype(std::declval() == std::declval()); template static auto test(...)->std::false_type; using type = typename std::is_same(0))>::type; }; template struct has_operator_equals : has_operator_equals_impl::type {}; template struct derived_point_vector; template class ContainerT, class PointT> struct derived_point_vector, PointT> { template using type = ContainerT; }; template< class ValueT, std::size_t UPPER_BOUND, class AllocatorT, template class ContainerT, class PointT> struct derived_point_vector, PointT> { using kPointCapacity = std::integral_constant< std::uint32_t, ContainerT::capacity() / static_cast(sizeof(PointT))>; template using type = ContainerT; }; } // namespace detail } // namespace point_cloud_msg_wrapper #endif // POINT_CLOUD_MSG_WRAPPER__TYPE_TRAITS_HPP_