• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/config.hpp>
10 #include <boost/math/tools/cxx03_warn.hpp>
11 
12 #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_SFINAE_EXPR)
13 
14 #define BOOST_MATH_HAS_IS_CONST_ITERABLE
15 
16 #include <boost/type_traits/is_detected.hpp>
17 #include <utility>
18 
19 namespace boost {
20    namespace math {
21       namespace tools {
22          namespace detail {
23 
24             template<class T>
25             using begin_t = decltype(std::declval<const T&>().begin());
26             template<class T>
27             using end_t = decltype(std::declval<const T&>().end());
28             template<class T>
29             using const_iterator_t = typename T::const_iterator;
30 
31             template <class T>
32             struct is_const_iterable
33                : public boost::integral_constant<bool,
34                boost::is_detected<begin_t, T>::value
35                && boost::is_detected<end_t, T>::value
36                && boost::is_detected<const_iterator_t, T>::value
37                > {};
38 
39 } } } }
40 
41 #endif
42 
43 #endif // BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP
44