is_const_iterable.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // (C) Copyright John Maddock 2018.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP
  6. #define BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP
  7. #include <boost/math/tools/cxx03_warn.hpp>
  8. #define BOOST_MATH_HAS_IS_CONST_ITERABLE
  9. #include <boost/math/tools/is_detected.hpp>
  10. #include <utility>
  11. namespace boost {
  12. namespace math {
  13. namespace tools {
  14. namespace detail {
  15. template<class T>
  16. using begin_t = decltype(std::declval<const T&>().begin());
  17. template<class T>
  18. using end_t = decltype(std::declval<const T&>().end());
  19. template<class T>
  20. using const_iterator_t = typename T::const_iterator;
  21. template <class T>
  22. struct is_const_iterable
  23. : public std::integral_constant<bool,
  24. is_detected<begin_t, T>::value
  25. && is_detected<end_t, T>::value
  26. && is_detected<const_iterator_t, T>::value
  27. > {};
  28. } } } }
  29. #endif // BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP