size_impl.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef BOOST_MPL_AUX_SIZE_IMPL_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_SIZE_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/size_fwd.hpp>
  14. #include <boost/mpl/begin_end.hpp>
  15. #include <boost/mpl/distance.hpp>
  16. #include <boost/mpl/aux_/traits_lambda_spec.hpp>
  17. #include <boost/mpl/aux_/config/workaround.hpp>
  18. namespace boost { namespace mpl {
  19. // default implementation; conrete sequences might override it by
  20. // specializing either the 'size_impl' or the primary 'size' template
  21. template< typename Tag >
  22. struct size_impl
  23. {
  24. template< typename Sequence > struct apply
  25. #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561))
  26. : distance<
  27. typename begin<Sequence>::type
  28. , typename end<Sequence>::type
  29. >
  30. {
  31. #else
  32. {
  33. typedef typename distance<
  34. typename begin<Sequence>::type
  35. , typename end<Sequence>::type
  36. >::type type;
  37. #endif
  38. };
  39. };
  40. BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1, size_impl)
  41. }}
  42. #endif // BOOST_MPL_AUX_SIZE_IMPL_HPP_INCLUDED