Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:47

0001 // Range v3 library
0002 //
0003 //  Copyright Eric Niebler 2014-present
0004 //
0005 //  Use, modification and distribution is subject to the
0006 //  Boost Software License, Version 1.0. (See accompanying
0007 //  file LICENSE_1_0.txt or copy at
0008 //  http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 // Project home: https://github.com/ericniebler/range-v3
0011 //
0012 
0013 #ifndef RANGES_V3_DETAIL_SATISFY_BOOST_RANGE_HPP
0014 #define RANGES_V3_DETAIL_SATISFY_BOOST_RANGE_HPP
0015 
0016 #include <meta/meta.hpp>
0017 
0018 #include <range/v3/range_fwd.hpp>
0019 
0020 #include <range/v3/range/concepts.hpp>
0021 #include <range/v3/range/traits.hpp>
0022 
0023 #ifndef RANGES_DOXYGEN_INVOKED
0024 namespace boost
0025 {
0026     /// \brief Boost Range specialisation point, for making Boost ranges out of range-v3
0027     /// views
0028     template<typename T, typename U>
0029     struct range_mutable_iterator;
0030 
0031     /// \brief Boost Range specialisation point, for making Boost ranges out of range-v3
0032     /// views
0033     template<typename T, typename U>
0034     struct range_const_iterator;
0035 
0036     /// \brief Boost Range specialisation point, for making Boost ranges out of range-v3
0037     /// views
0038     template<typename T>
0039     struct range_value;
0040 
0041     /// \brief Boost Range specialisation point, for making Boost ranges out of range-v3
0042     /// views
0043     template<typename T>
0044     struct range_size;
0045 } // namespace boost
0046 
0047 /// \brief Macro specialising Boost Range metafunctions for the specified view
0048 #define RANGES_SATISFY_BOOST_RANGE(view_name)                                           \
0049     namespace boost                                                                     \
0050     {                                                                                   \
0051         template<typename... Ts>                                                        \
0052         struct range_mutable_iterator<                                                  \
0053             view_name<Ts...>,                                                           \
0054             ::meta::if_c<(bool)::ranges::common_range<view_name<Ts...>>>>               \
0055         {                                                                               \
0056             using type = ::ranges::iterator_t<view_name<Ts...>>;                        \
0057         };                                                                              \
0058         template<typename... Ts>                                                        \
0059         struct range_const_iterator<                                                    \
0060             view_name<Ts...>,                                                           \
0061             ::meta::if_c<(bool)::ranges::common_range<view_name<Ts...> const>>>         \
0062         {                                                                               \
0063             using type = ::ranges::iterator_t<view_name<Ts...> const>;                  \
0064         };                                                                              \
0065         template<typename... Ts>                                                        \
0066         struct range_value<view_name<Ts...>>                                            \
0067         {                                                                               \
0068             using type = ::ranges::range_value_t<view_name<Ts...>>;                     \
0069         };                                                                              \
0070         template<typename... Ts>                                                        \
0071         struct range_size<view_name<Ts...>>                                             \
0072           : ::meta::if_c<(bool)::ranges::common_range<view_name<Ts...>>,                \
0073                          ::meta::defer<::ranges::range_size_t, view_name<Ts...>>,       \
0074                          ::meta::nil_>                                                  \
0075         {};                                                                             \
0076         template<typename... Ts>                                                        \
0077         struct range_size<view_name<Ts...> const>                                       \
0078           : ::meta::if_c<(bool)::ranges::common_range<view_name<Ts...> const>,          \
0079                          ::meta::defer<::ranges::range_size_t, view_name<Ts...> const>, \
0080                          ::meta::nil_>                                                  \
0081         {};                                                                             \
0082     }
0083 #else
0084 #define RANGES_SATISFY_BOOST_RANGE(view_name)
0085 #endif
0086 
0087 #endif