| 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 |
|
| 6 |
#ifndef BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP |
| 7 |
#define BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP |
| 8 |
|
| 9 |
#include <boost/math/tools/cxx03_warn.hpp> |
| 10 |
|
| 11 |
#define BOOST_MATH_HAS_IS_CONST_ITERABLE |
| 12 |
|
| 13 |
#include <boost/math/tools/is_detected.hpp> |
| 14 |
#include <utility> |
| 15 |
|
| 16 |
namespace boost { |
| 17 |
namespace math { |
| 18 |
namespace tools { |
| 19 |
namespace detail { |
| 20 |
|
| 21 |
template<class T> |
| 22 |
using begin_t = decltype(std::declval<const T&>().begin()); |
| 23 |
template<class T> |
| 24 |
using end_t = decltype(std::declval<const T&>().end()); |
| 25 |
template<class T> |
| 26 |
using const_iterator_t = typename T::const_iterator; |
| 27 |
|
| 28 |
template <class T> |
| 29 |
struct is_const_iterable |
| 30 |
: public std::integral_constant<bool, |
| 31 |
is_detected<begin_t, T>::value |
| 32 |
&& is_detected<end_t, T>::value |
| 33 |
&& is_detected<const_iterator_t, T>::value |
| 34 |
> {}; |
| 35 |
|
| 36 |
} } } } |
| 37 |
|
| 38 |
#endif // BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP |