]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Copyright 2015 John Maddock. Distributed under the Boost | |
3 | // 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_IS_BYTE_CONTAINER_HPP | |
7 | #define BOOST_IS_BYTE_CONTAINER_HPP | |
8 | ||
92f5a8d4 | 9 | #include <iterator> |
7c673cae FG |
10 | #include <boost/mpl/has_xxx.hpp> |
11 | #include <boost/type_traits/is_integral.hpp> | |
92f5a8d4 | 12 | #include <boost/type_traits/remove_cv.hpp> |
7c673cae | 13 | |
92f5a8d4 | 14 | namespace boost { namespace multiprecision { namespace detail { |
7c673cae | 15 | |
92f5a8d4 | 16 | BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_member_const_iterator, const_iterator, false) |
7c673cae | 17 | |
92f5a8d4 TL |
18 | template <class C, bool b> |
19 | struct is_byte_container_imp | |
20 | { | |
21 | // Note: Don't use C::value_type as this is a rather widespread typedef, even for non-range types | |
22 | typedef typename boost::remove_cv<typename std::iterator_traits<typename C::const_iterator>::value_type>::type container_value_type; | |
23 | static const bool value = boost::is_integral<container_value_type>::value && (sizeof(container_value_type) == 1); | |
24 | }; | |
7c673cae | 25 | |
92f5a8d4 TL |
26 | template <class C> |
27 | struct is_byte_container_imp<C, false> : public boost::false_type | |
28 | {}; | |
7c673cae | 29 | |
92f5a8d4 TL |
30 | template <class C> |
31 | struct is_byte_container : public is_byte_container_imp<C, has_member_const_iterator<C>::value> | |
32 | {}; | |
7c673cae | 33 | |
92f5a8d4 | 34 | }}} // namespace boost::multiprecision::detail |
7c673cae FG |
35 | |
36 | #endif // BOOST_IS_BYTE_CONTAINER_HPP |