size_type.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Boost.Range library
  2. //
  3. // Copyright Thorsten Ottosen 2003-2004. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // For more information, see http://www.boost.org/libs/range/
  9. //
  10. #ifndef BOOST_RANGE_DETAIL_SIZE_TYPE_HPP
  11. #define BOOST_RANGE_DETAIL_SIZE_TYPE_HPP
  12. #include <boost/range/detail/common.hpp>
  13. //////////////////////////////////////////////////////////////////////////////
  14. // missing partial specialization workaround.
  15. //////////////////////////////////////////////////////////////////////////////
  16. namespace boost
  17. {
  18. namespace range_detail
  19. {
  20. template< typename T >
  21. struct range_size_type_
  22. {
  23. template< typename C >
  24. struct pts
  25. {
  26. typedef std::size_t type;
  27. };
  28. };
  29. template<>
  30. struct range_size_type_<std_container_>
  31. {
  32. template< typename C >
  33. struct pts
  34. {
  35. typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type;
  36. };
  37. };
  38. }
  39. template< typename C >
  40. class range_size
  41. {
  42. typedef typename range_detail::range<C>::type c_type;
  43. public:
  44. typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
  45. };
  46. }
  47. #endif