/Src/Dependencies/Boost/boost/range/size_type.hpp

http://hadesmem.googlecode.com/ · C++ Header · 79 lines · 43 code · 18 blank · 18 comment · 1 complexity · f5d77e5bf8266c1d898c7e79aa1ad66e MD5 · raw file

  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_SIZE_TYPE_HPP
  11. #define BOOST_RANGE_SIZE_TYPE_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  13. # pragma once
  14. #endif
  15. #include <boost/range/config.hpp>
  16. #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  17. #include <boost/range/detail/size_type.hpp>
  18. #else
  19. #include <boost/type_traits/remove_const.hpp>
  20. #include <cstddef>
  21. #include <utility>
  22. namespace boost
  23. {
  24. namespace detail
  25. {
  26. //////////////////////////////////////////////////////////////////////////
  27. // default
  28. //////////////////////////////////////////////////////////////////////////
  29. template< typename C >
  30. struct range_size
  31. {
  32. typedef BOOST_DEDUCED_TYPENAME C::size_type type;
  33. };
  34. //////////////////////////////////////////////////////////////////////////
  35. // pair
  36. //////////////////////////////////////////////////////////////////////////
  37. template< typename Iterator >
  38. struct range_size< std::pair<Iterator,Iterator> >
  39. {
  40. typedef std::size_t type;
  41. };
  42. //////////////////////////////////////////////////////////////////////////
  43. // array
  44. //////////////////////////////////////////////////////////////////////////
  45. template< typename T, std::size_t sz >
  46. struct range_size< T[sz] >
  47. {
  48. typedef std::size_t type;
  49. };
  50. }
  51. template< class T >
  52. struct range_size :
  53. detail::range_size<T>
  54. { };
  55. template< class T >
  56. struct range_size<const T >
  57. : detail::range_size<T>
  58. { };
  59. } // namespace boost
  60. #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  61. #endif