From 7b854477f8764eed0893c4db28a4992e8258f71f Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Mon, 26 Jul 2021 21:07:08 +0300 Subject: [PATCH] Put mp_front into its own file --- include/boost/mp11/detail/mp_front.hpp | 42 ++++++++++++++++++++++++++ include/boost/mp11/list.hpp | 19 ++---------- 2 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 include/boost/mp11/detail/mp_front.hpp diff --git a/include/boost/mp11/detail/mp_front.hpp b/include/boost/mp11/detail/mp_front.hpp new file mode 100644 index 0000000..2183f15 --- /dev/null +++ b/include/boost/mp11/detail/mp_front.hpp @@ -0,0 +1,42 @@ +#ifndef BOOST_MP11_DETAIL_MP_FRONT_HPP_INCLUDED +#define BOOST_MP11_DETAIL_MP_FRONT_HPP_INCLUDED + +// Copyright 2015-2021 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 +#include +#include + +namespace boost +{ +namespace mp11 +{ + +// mp_front +namespace detail +{ + +template struct mp_front_impl +{ +// An error "no type named 'type'" here means that the argument to mp_front +// is either not a list, or is an empty list +}; + +template class L, class T1, class... T> struct mp_front_impl> +{ + using type = T1; +}; + +} // namespace detail + +template using mp_front = typename detail::mp_front_impl::type; + +} // namespace mp11 +} // namespace boost + +#endif // #ifndef BOOST_MP11_DETAIL_MP_FRONT_HPP_INCLUDED diff --git a/include/boost/mp11/list.hpp b/include/boost/mp11/list.hpp index e0d3e29..6ab12dd 100644 --- a/include/boost/mp11/list.hpp +++ b/include/boost/mp11/list.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -66,23 +67,7 @@ template using mp_assign = typename detail::mp_assign_impl using mp_clear = mp_assign>; // mp_front -namespace detail -{ - -template struct mp_front_impl -{ -// An error "no type named 'type'" here means that the argument to mp_front -// is either not a list, or is an empty list -}; - -template class L, class T1, class... T> struct mp_front_impl> -{ - using type = T1; -}; - -} // namespace detail - -template using mp_front = typename detail::mp_front_impl::type; +// in detail/mp_front.hpp // mp_pop_front namespace detail