back_impl.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef BOOST_MPL_AUX_BACK_IMPL_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_BACK_IMPL_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/begin_end.hpp>
  14. #include <boost/mpl/next_prior.hpp>
  15. #include <boost/mpl/deref.hpp>
  16. #include <boost/mpl/aux_/traits_lambda_spec.hpp>
  17. namespace boost { namespace mpl {
  18. // default implementation, requires at least bi-directional iterators;
  19. // conrete sequences might override it by specializing either the
  20. // 'back_impl' or the primary 'back' template
  21. template< typename Tag >
  22. struct back_impl
  23. {
  24. template< typename Sequence > struct apply
  25. {
  26. typedef typename end<Sequence>::type end_;
  27. typedef typename prior<end_>::type last_;
  28. typedef typename deref<last_>::type type;
  29. };
  30. };
  31. BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1, back_impl)
  32. }}
  33. #endif // BOOST_MPL_AUX_BACK_IMPL_HPP_INCLUDED