is_range.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/util/detail/is_range.hpp
  4. [begin_description]
  5. is_range implementation. Taken from the boost::range library.
  6. [end_description]
  7. Copyright 2011-2013 Karsten Ahnert
  8. Copyright 2011-2013 Thorsten Ottosen
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED
  15. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  16. # pragma once
  17. #endif
  18. #include <cstddef>
  19. #include <type_traits>
  20. #include <boost/range/config.hpp>
  21. #include <boost/numeric/odeint/tools/traits.hpp>
  22. namespace boost {
  23. namespace numeric {
  24. namespace odeint {
  25. namespace detail {
  26. BOOST_NUMERIC_ODEINT_HAS_NAMED_TRAIT(has_iterator, iterator);
  27. BOOST_NUMERIC_ODEINT_HAS_NAMED_TRAIT(has_const_iterator, const_iterator);
  28. template< typename Range >
  29. struct is_range : std::integral_constant<bool, (has_iterator<Range>::value && has_const_iterator<Range>::value)>
  30. {
  31. };
  32. //////////////////////////////////////////////////////////////////////////
  33. // pair
  34. //////////////////////////////////////////////////////////////////////////
  35. template< typename iteratorT >
  36. struct is_range< std::pair<iteratorT,iteratorT> > : std::integral_constant<bool, true>
  37. {
  38. };
  39. template< typename iteratorT >
  40. struct is_range< const std::pair<iteratorT,iteratorT> > : std::integral_constant<bool, true>
  41. {
  42. };
  43. //////////////////////////////////////////////////////////////////////////
  44. // array
  45. //////////////////////////////////////////////////////////////////////////
  46. template< typename elementT, std::size_t sz >
  47. struct is_range< elementT[sz] > : std::integral_constant<bool, true>
  48. {
  49. };
  50. template< typename elementT, std::size_t sz >
  51. struct is_range< const elementT[sz] > : std::integral_constant<bool, true>
  52. {
  53. };
  54. //////////////////////////////////////////////////////////////////////////
  55. // string
  56. //////////////////////////////////////////////////////////////////////////
  57. template<>
  58. struct is_range< char* > : std::integral_constant<bool, true>
  59. {
  60. };
  61. template<>
  62. struct is_range< wchar_t* > : std::integral_constant<bool, true>
  63. {
  64. };
  65. template<>
  66. struct is_range< const char* > : std::integral_constant<bool, true>
  67. {
  68. };
  69. template<>
  70. struct is_range< const wchar_t* > : std::integral_constant<bool, true>
  71. {
  72. };
  73. template<>
  74. struct is_range< char* const > : std::integral_constant<bool, true>
  75. {
  76. };
  77. template<>
  78. struct is_range< wchar_t* const > : std::integral_constant<bool, true>
  79. {
  80. };
  81. template<>
  82. struct is_range< const char* const > : std::integral_constant<bool, true>
  83. {
  84. };
  85. template<>
  86. struct is_range< const wchar_t* const > : std::integral_constant<bool, true>
  87. {
  88. };
  89. } // namespace detail
  90. } // namespace odeint
  91. } // namespace numeric
  92. } // namespace boost
  93. #endif // BOOST_NUMERIC_ODEINT_UTIL_DETAIL_IS_RANGE_HPP_INCLUDED