forked from boostorg/mp11
Unroll mp_append a bit.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef BOOST_MP11_LIST_HPP_INCLUDED
|
||||
#define BOOST_MP11_LIST_HPP_INCLUDED
|
||||
|
||||
// Copyright 2015 Peter Dimov.
|
||||
// Copyright 2015-2017 Peter Dimov.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/detail/mp_list.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -166,6 +168,28 @@ template<template<class...> class L1, class... T1, template<class...> class L2,
|
||||
using type = typename mp_append_impl<L1<T1..., T2...>, Lr...>::type;
|
||||
};
|
||||
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 )
|
||||
#else
|
||||
|
||||
template<
|
||||
template<class...> class L1, class... T1,
|
||||
template<class...> class L2, class... T2,
|
||||
template<class...> class L3, class... T3,
|
||||
template<class...> class L4, class... T4,
|
||||
template<class...> class L5, class... T5,
|
||||
template<class...> class L6, class... T6,
|
||||
template<class...> class L7, class... T7,
|
||||
template<class...> class L8, class... T8,
|
||||
template<class...> class L9, class... T9,
|
||||
template<class...> class L10, class... T10,
|
||||
class... Lr>
|
||||
struct mp_append_impl<L1<T1...>, L2<T2...>, L3<T3...>, L4<T4...>, L5<T5...>, L6<T6...>, L7<T7...>, L8<T8...>, L9<T9...>, L10<T10...>, Lr...>
|
||||
{
|
||||
using type = typename mp_append_impl<L1<T1..., T2..., T3..., T4..., T5..., T6..., T7..., T8..., T9..., T10...>, Lr...>::type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class... L> using mp_append = typename detail::mp_append_impl<L...>::type;
|
||||
|
@@ -25,6 +25,7 @@ run mp_push_front.cpp : : : $(REQ) ;
|
||||
run mp_push_back.cpp : : : $(REQ) ;
|
||||
run mp_rename.cpp : : : $(REQ) ;
|
||||
run mp_append.cpp : : : $(REQ) ;
|
||||
run mp_append_2.cpp : : : $(REQ) ;
|
||||
run mp_replace_front.cpp : : : $(REQ) ;
|
||||
run mp_replace_second.cpp : : : $(REQ) ;
|
||||
run mp_replace_third.cpp : : : $(REQ) ;
|
||||
|
35
test/mp_append_2.cpp
Normal file
35
test/mp_append_2.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
// Copyright 2015 Peter Dimov.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <type_traits>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mp11::mp_list;
|
||||
using boost::mp11::mp_append;
|
||||
using boost::mp11::mp_iota_c;
|
||||
using boost::mp11::mp_transform;
|
||||
using boost::mp11::mp_rename;
|
||||
|
||||
using L1 = mp_iota_c<97>;
|
||||
using L2 = mp_transform<mp_list, L1>;
|
||||
|
||||
using L3 = mp_rename<L2, mp_append>;
|
||||
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<L3, L1>));
|
||||
|
||||
//
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user