Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:32

0001 // Boost.Geometry Index
0002 //
0003 // Copyright (c) 2011-2019 Adam Wulkiewicz, Lodz, Poland.
0004 //
0005 // This file was modified by Oracle on 2020.
0006 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
0007 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0008 //
0009 // Use, modification and distribution is subject to the Boost Software License,
0010 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_META_HPP
0014 #define BOOST_GEOMETRY_INDEX_DETAIL_META_HPP
0015 
0016 #include <type_traits>
0017 
0018 //#include <boost/range/value_type.hpp>
0019 
0020 namespace boost { namespace geometry { namespace index { namespace detail {
0021 
0022 //template <typename T, typename V, bool IsRange = range::detail::is_range<T>::value>
0023 //struct is_range_of_convertible_values_impl
0024 //    : std::is_convertible<typename ::boost::range_value<T>::type, V>
0025 //{};
0026 //
0027 //template <typename T, typename V>
0028 //struct is_range_of_convertible_values_impl<T, V, false>
0029 //    : std::integral_constant<bool, false>
0030 //{};
0031 //
0032 //template <typename T, typename V>
0033 //struct is_range_of_convertible_values
0034 //    : is_range_of_convertible_values_impl<T, V>
0035 //{};
0036 
0037 // Implemented this way in order to prevent instantiation of all type traits at
0038 // once because some of them are causing problems with gcc 4.6 namely
0039 // is_convertible<bg::model::segment<>, std::pair<bg::model::segment<>, T> >
0040 // because segment<> is derived from pair<> and pair<> has copy ctor taking
0041 // other pair<> of any types the compiler tries to instantiate ctor of
0042 // pair<segment, T> taking pair<point, point> which results in instantiation of
0043 // segment's ctor taking a point which results in compilation error.
0044 // This is probably compiler's bug.
0045 template <typename T, typename Value, typename Indexable, typename ResultType, int Ver>
0046 struct convertible_type_impl
0047 {
0048     typedef ResultType type;
0049 };
0050 
0051 template <typename T, typename Value, typename Indexable>
0052 struct convertible_type_impl<T, Value, Indexable, void, 0>
0053 {
0054     typedef std::conditional_t
0055         <
0056             std::is_convertible<T, Indexable>::value,
0057             Indexable,
0058             void
0059         > result_type;
0060 
0061     typedef typename convertible_type_impl
0062         <
0063             T, Value, Indexable, result_type, 1
0064         >::type type;
0065 };
0066 
0067 template <typename T, typename Value, typename Indexable>
0068 struct convertible_type_impl<T, Value, Indexable, void, 1>
0069 {
0070     typedef std::conditional_t
0071         <
0072             std::is_convertible<T, Value>::value,
0073             Value,
0074             void
0075         > type;
0076 };
0077 
0078 template <typename T, typename Value, typename Indexable>
0079 struct convertible_type
0080 {
0081     typedef std::conditional_t
0082         <
0083             std::is_same<T, Value>::value,
0084             Value,
0085             std::conditional_t
0086                 <
0087                     std::is_same<T, Indexable>::value,
0088                     Indexable,
0089                     void
0090                 >
0091         > result_type;
0092 
0093     typedef typename convertible_type_impl
0094         <
0095             T, Value, Indexable, result_type, 0
0096         >::type type;
0097 };
0098 
0099 }}}} // namespace boost::geometry::index::detail
0100 
0101 #endif // BOOST_GEOMETRY_INDEX_DETAIL_META_HPP