1
0
forked from boostorg/mp11

mp_rotate_*: remove default rotation count

This commit is contained in:
Peter Dimov
2020-01-18 18:31:06 +02:00
parent 03f6096230
commit d3f0738bf4
3 changed files with 6 additions and 36 deletions

View File

@ -1147,12 +1147,12 @@ template<template<class...> class L, class... T, std::size_t N> struct mp_rotate
} // namespace detail
template<class L, std::size_t N = 1> using mp_rotate_left_c = typename detail::mp_rotate_impl<L, detail::canonical_rotation_t<L, N>, detail::left_rotation>::type;
template<class L, class N = mp_size_t<1>> using mp_rotate_left = mp_rotate_left_c<L, std::size_t{ N::value }>;
template<class L, std::size_t N> using mp_rotate_left_c = typename detail::mp_rotate_impl<L, detail::canonical_rotation_t<L, N>, detail::left_rotation>::type;
template<class L, class N> using mp_rotate_left = mp_rotate_left_c<L, std::size_t{ N::value }>;
// mp_rotate_right(_c)<L, N>
template<class L, std::size_t N = 1> using mp_rotate_right_c = typename detail::mp_rotate_impl<L, detail::canonical_rotation_t<L, N>, detail::right_rotation>::type;
template<class L, class N = mp_size_t<1>> using mp_rotate_right = mp_rotate_right_c<L, std::size_t{ N::value }>;
template<class L, std::size_t N> using mp_rotate_right_c = typename detail::mp_rotate_impl<L, detail::canonical_rotation_t<L, N>, detail::right_rotation>::type;
template<class L, class N> using mp_rotate_right = mp_rotate_right_c<L, std::size_t{ N::value }>;
// mp_min_element<L, P>
// mp_max_element<L, P>

View File

@ -1,5 +1,5 @@
// Copyright 2015 Peter Dimov.
// Copyright 2015 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
@ -31,9 +31,6 @@ int main()
{
using L1 = mp_list<>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 0>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 2>, L1>));
@ -48,9 +45,6 @@ int main()
using L2 = mp_list<X1, X2, X3, X4, X5>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2>, mp_list<X2, X3, X4, X5, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left<L2>, mp_list<X2, X3, X4, X5, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2, 0>, mp_list<X1, X2, X3, X4, X5>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2, 1>, mp_list<X2, X3, X4, X5, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2, 2>, mp_list<X3, X4, X5, X1, X2>>));
@ -79,9 +73,6 @@ int main()
{
using L1 = std::tuple<>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 0>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 2>, L1>));
@ -96,9 +87,6 @@ int main()
using L2 = std::tuple<X1, X2, X3, X4, X5>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2>, std::tuple<X2, X3, X4, X5, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left<L2>, std::tuple<X2, X3, X4, X5, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2, 0>, std::tuple<X1, X2, X3, X4, X5>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2, 1>, std::tuple<X2, X3, X4, X5, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L2, 2>, std::tuple<X3, X4, X5, X1, X2>>));
@ -127,9 +115,6 @@ int main()
{
using L1 = std::pair<X1, X2>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1>, std::pair<X2, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left<L1>, std::pair<X2, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 0>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 2>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_left_c<L1, 4>, L1>));

View File

@ -1,5 +1,5 @@
// Copyright 2015 Peter Dimov.
// Copyright 2015 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
@ -31,9 +31,6 @@ int main()
{
using L1 = mp_list<>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 0>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 2>, L1>));
@ -48,9 +45,6 @@ int main()
using L2 = mp_list<X1, X2, X3, X4, X5>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2>, mp_list<X5, X1, X2, X3, X4>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right<L2>, mp_list<X5, X1, X2, X3, X4>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2, 0>, mp_list<X1, X2, X3, X4, X5>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2, 1>, mp_list<X5, X1, X2, X3, X4>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2, 2>, mp_list<X4, X5, X1, X2, X3>>));
@ -79,9 +73,6 @@ int main()
{
using L1 = std::tuple<>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right<L1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 0>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 1>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 2>, L1>));
@ -96,9 +87,6 @@ int main()
using L2 = std::tuple<X1, X2, X3, X4, X5>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2>, std::tuple<X5, X1, X2, X3, X4>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right<L2>, std::tuple<X5, X1, X2, X3, X4>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2, 0>, std::tuple<X1, X2, X3, X4, X5>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2, 1>, std::tuple<X5, X1, X2, X3, X4>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L2, 2>, std::tuple<X4, X5, X1, X2, X3>>));
@ -127,9 +115,6 @@ int main()
{
using L1 = std::pair<X1, X2>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1>, std::pair<X2, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right<L1>, std::pair<X2, X1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 0>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 2>, L1>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rotate_right_c<L1, 4>, L1>));