Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:24

0001 // Copyright 2017, 2018 Peter Dimov.
0002 // Distributed under the Boost Software License, Version 1.0.
0003 // https://www.boost.org/LICENSE_1_0.txt
0004 
0005 #ifndef BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED
0006 #define BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED
0007 
0008 #include <boost/container_hash/is_range.hpp>
0009 #include <boost/config.hpp>
0010 #include <boost/config/workaround.hpp>
0011 #include <type_traits>
0012 
0013 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
0014 
0015 #include <iterator>
0016 
0017 namespace boost
0018 {
0019 namespace hash_detail
0020 {
0021 
0022 template<class It, class T, class S>
0023     std::integral_constant< bool, std::is_same<typename std::iterator_traits<It>::value_type, T>::value && std::is_integral<S>::value >
0024         is_contiguous_range_check( It first, It last, T const*, T const*, S );
0025 
0026 template<class T> decltype( is_contiguous_range_check( std::declval<T const&>().begin(), std::declval<T const&>().end(), std::declval<T const&>().data(), std::declval<T const&>().data() + std::declval<T const&>().size(), std::declval<T const&>().size() ) ) is_contiguous_range_( int );
0027 template<class T> std::false_type is_contiguous_range_( ... );
0028 
0029 template<class T> struct is_contiguous_range: decltype( hash_detail::is_contiguous_range_<T>( 0 ) )
0030 {
0031 };
0032 
0033 } // namespace hash_detail
0034 
0035 namespace container_hash
0036 {
0037 
0038 template<class T> struct is_contiguous_range: std::integral_constant< bool, is_range<T>::value && hash_detail::is_contiguous_range<T>::value >
0039 {
0040 };
0041 
0042 } // namespace container_hash
0043 } // namespace boost
0044 
0045 #else // !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
0046 
0047 #include <cstddef>
0048 #include <vector>
0049 #include <string>
0050 #include <array>
0051 
0052 namespace boost
0053 {
0054 namespace container_hash
0055 {
0056 
0057 template<class T> struct is_contiguous_range: std::false_type
0058 {
0059 };
0060 
0061 template<class E, class T, class A> struct is_contiguous_range< std::basic_string<E, T, A> >: std::true_type
0062 {
0063 };
0064 
0065 template<class E, class T, class A> struct is_contiguous_range< std::basic_string<E, T, A> const >: std::true_type
0066 {
0067 };
0068 
0069 template<class T, class A> struct is_contiguous_range< std::vector<T, A> >: std::true_type
0070 {
0071 };
0072 
0073 template<class T, class A> struct is_contiguous_range< std::vector<T, A> const >: std::true_type
0074 {
0075 };
0076 
0077 template<class A> struct is_contiguous_range< std::vector<bool, A> >: std::false_type
0078 {
0079 };
0080 
0081 template<class A> struct is_contiguous_range< std::vector<bool, A> const >: std::false_type
0082 {
0083 };
0084 
0085 template<class T, std::size_t N> struct is_contiguous_range< std::array<T, N> >: std::true_type
0086 {
0087 };
0088 
0089 template<class T, std::size_t N> struct is_contiguous_range< std::array<T, N> const >: std::true_type
0090 {
0091 };
0092 
0093 } // namespace container_hash
0094 } // namespace boost
0095 
0096 #endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
0097 
0098 #endif // #ifndef BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED