diff --git a/include/boost/mp11/list.hpp b/include/boost/mp11/list.hpp index b5daed3..0189d74 100644 --- a/include/boost/mp11/list.hpp +++ b/include/boost/mp11/list.hpp @@ -123,6 +123,15 @@ template class L, class T1, class... T> struct mp_pop_front_i using type = L; }; +#if defined(BOOST_MP11_HAS_TEMPLATE_AUTO) + +template class L, auto A1, auto... A> struct mp_pop_front_impl> +{ + using type = L; +}; + +#endif + } // namespace detail template using mp_pop_front = typename detail::mp_pop_front_impl::type; diff --git a/test/Jamfile b/test/Jamfile index 6681cf1..4c9b626 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -36,6 +36,7 @@ run mp_clear_2.cpp ; run mp_front.cpp ; run mp_front_2.cpp ; run mp_pop_front.cpp ; +run mp_pop_front_2.cpp ; run mp_second.cpp ; run mp_third.cpp ; run mp_push_front.cpp ; diff --git a/test/mp_pop_front_2.cpp b/test/mp_pop_front_2.cpp new file mode 100644 index 0000000..cfd79ea --- /dev/null +++ b/test/mp_pop_front_2.cpp @@ -0,0 +1,37 @@ +// Copyright 2023 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include + +#if !defined(BOOST_MP11_HAS_TEMPLATE_AUTO) + +#pragma message("Test skipped because BOOST_MP11_HAS_TEMPLATE_AUTO is not defined") +int main() {} + +#else + +#include + +template struct L1 {}; +template struct L2 {}; + +int main() +{ + using boost::mp11::mp_list_v; + using boost::mp11::mp_pop_front; + using boost::mp11::mp_rest; + + BOOST_TEST_TRAIT_SAME(mp_pop_front>, mp_list_v<>); + BOOST_TEST_TRAIT_SAME(mp_rest>, mp_list_v<>); + + BOOST_TEST_TRAIT_SAME(mp_pop_front>, L1); + BOOST_TEST_TRAIT_SAME(mp_rest>, L1); + + BOOST_TEST_TRAIT_SAME(mp_pop_front>, L2<1, 2>); + BOOST_TEST_TRAIT_SAME(mp_rest>, L2<1, 2>); + + return boost::report_errors(); +} + +#endif