// Boost.Geometry // Copyright (c) 2020, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_UTIL_TYPE_TRAITS_STD_HPP #define BOOST_GEOMETRY_UTIL_TYPE_TRAITS_STD_HPP #include #include namespace boost { namespace geometry { namespace util { // C++17 template using bool_constant = std::integral_constant; // non-standard template using int_constant = std::integral_constant; // non-standard template using index_constant = std::integral_constant; // non-standard template using size_constant = std::integral_constant; // C++17 template struct conjunction : std::true_type {}; template struct conjunction : Trait {}; template struct conjunction : std::conditional_t, Trait> {}; // C++17 template struct disjunction : std::false_type {}; template struct disjunction : Trait {}; template struct disjunction : std::conditional_t> {}; // C++17 template struct negation : bool_constant {}; // non-standard /* template using and_ = conjunction; template using or_ = disjunction; template using not_ = negation; */ // C++20 template struct remove_cvref { using type = std::remove_cv_t>; }; template using remove_cvref_t = typename remove_cvref::type; // non-standard template struct remove_cref { using type = std::remove_const_t>; }; template using remove_cref_t = typename remove_cref::type; // non-standard template struct remove_cptrref { using type = std::remove_const_t < std::remove_pointer_t> >; }; template using remove_cptrref_t = typename remove_cptrref::type; // non-standard template struct transcribe_const { using type = std::conditional_t < std::is_const>::value, std::add_const_t, To >; }; template using transcribe_const_t = typename transcribe_const::type; } // namespace util // Deprecated utilities, defined for backward compatibility but might be // removed in the future. /*! \brief Meta-function to define a const or non const type \ingroup utility \details If the boolean template parameter is true, the type parameter will be defined as const, otherwise it will be defined as it was. This meta-function is used to have one implementation for both const and non const references \note This traits class is completely independant from Boost.Geometry and might be a separate addition to Boost \note Used in a.o. for_each, interior_rings, exterior_ring \par Example \code void foo(typename add_const_if_c::type& point) \endcode */ template struct add_const_if_c { typedef std::conditional_t < IsConst, Type const, Type > type; }; namespace util { template using bare_type = remove_cptrref; } // namespace util }} // namespace boost::geometry #endif // BOOST_GEOMETRY_UTIL_TYPE_TRAITS_STD_HPP