mp_front.hpp 855 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef BOOST_MP11_DETAIL_MP_FRONT_HPP_INCLUDED
  2. #define BOOST_MP11_DETAIL_MP_FRONT_HPP_INCLUDED
  3. // Copyright 2015-2021 Peter Dimov.
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. //
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. namespace boost
  10. {
  11. namespace mp11
  12. {
  13. // mp_front<L>
  14. namespace detail
  15. {
  16. template<class L> struct mp_front_impl
  17. {
  18. // An error "no type named 'type'" here means that the argument to mp_front
  19. // is either not a list, or is an empty list
  20. };
  21. template<template<class...> class L, class T1, class... T> struct mp_front_impl<L<T1, T...>>
  22. {
  23. using type = T1;
  24. };
  25. } // namespace detail
  26. template<class L> using mp_front = typename detail::mp_front_impl<L>::type;
  27. } // namespace mp11
  28. } // namespace boost
  29. #endif // #ifndef BOOST_MP11_DETAIL_MP_FRONT_HPP_INCLUDED