Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:20

0001 /* Copyright 2023 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See https://www.boost.org/libs/unordered for library home page.
0007  */
0008 
0009 #ifndef BOOST_UNORDERED_DETAIL_FOA_TUPLE_ROTATE_RIGHT_HPP
0010 #define BOOST_UNORDERED_DETAIL_FOA_TUPLE_ROTATE_RIGHT_HPP
0011 
0012 #include <boost/mp11/algorithm.hpp>
0013 #include <boost/mp11/integer_sequence.hpp>
0014 #include <tuple>
0015 #include <utility>
0016 
0017 namespace boost{
0018 namespace unordered{
0019 namespace detail{
0020 namespace foa{
0021 
0022 template<typename Tuple>
0023 using tuple_rotate_right_return_type=mp11::mp_rotate_right_c<
0024   typename std::remove_cv<typename std::remove_reference<Tuple>::type>::type,
0025   1
0026 >;
0027 
0028 template<std::size_t... Is,typename Tuple>
0029 tuple_rotate_right_return_type<Tuple>
0030 tuple_rotate_right_aux(mp11::index_sequence<Is...>,Tuple&& x)
0031 {
0032   return tuple_rotate_right_return_type<Tuple>{
0033     std::get<(Is+sizeof...(Is)-1)%sizeof...(Is)>(std::forward<Tuple>(x))...};
0034 }
0035 
0036 template<typename Tuple>
0037 tuple_rotate_right_return_type<Tuple> tuple_rotate_right(Tuple&& x)
0038 {
0039   using RawTuple=typename std::remove_cv<
0040     typename std::remove_reference<Tuple>::type>::type;
0041 
0042   return tuple_rotate_right_aux(
0043     mp11::make_index_sequence<std::tuple_size<RawTuple>::value>{},
0044     std::forward<Tuple>(x));
0045 }
0046 
0047 } /* namespace foa */
0048 } /* namespace detail */
0049 } /* namespace unordered */
0050 } /* namespace boost */
0051 
0052 #endif