File indexing completed on 2025-12-15 10:07:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
0012 #define BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
0013
0014 #include <boost/range/config.hpp>
0015 #include <boost/range/detail/common.hpp>
0016 #include <boost/type_traits/is_same.hpp>
0017 #include <cstddef>
0018 #include <string.h>
0019
0020 #ifndef BOOST_NO_CWCHAR
0021 #include <wchar.h>
0022 #endif
0023
0024 namespace boost
0025 {
0026 namespace range_detail
0027 {
0028 template <typename T>
0029 inline void boost_range_silence_warning( const T& ) { }
0030
0031
0032
0033
0034
0035 inline const char* str_end( const char* s, const char* )
0036 {
0037 return s + strlen( s );
0038 }
0039
0040 #ifndef BOOST_NO_CWCHAR
0041 inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
0042 {
0043 return s + wcslen( s );
0044 }
0045 #else
0046 inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
0047 {
0048 if( s == 0 || s[0] == 0 )
0049 return s;
0050 while( *++s != 0 )
0051 ;
0052 return s;
0053 }
0054 #endif
0055
0056 template< class Char >
0057 inline Char* str_end( Char* s )
0058 {
0059 return const_cast<Char*>( str_end( s, s ) );
0060 }
0061
0062 template< class T, std::size_t sz >
0063 BOOST_CONSTEXPR inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] ) BOOST_NOEXCEPT
0064 {
0065 return boost_range_array + sz;
0066 }
0067
0068 template< class T, std::size_t sz >
0069 BOOST_CONSTEXPR inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] ) BOOST_NOEXCEPT
0070 {
0071 return boost_range_array + sz;
0072 }
0073
0074
0075
0076
0077
0078 template< class Char >
0079 inline std::size_t str_size( const Char* const& s )
0080 {
0081 return str_end( s ) - s;
0082 }
0083
0084 template< class T, std::size_t sz >
0085 inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] )
0086 {
0087 boost_range_silence_warning( boost_range_array );
0088 return sz;
0089 }
0090
0091 template< class T, std::size_t sz >
0092 inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] )
0093 {
0094 boost_range_silence_warning( boost_range_array );
0095 return sz;
0096 }
0097
0098 inline bool is_same_address(const void* l, const void* r)
0099 {
0100 return l == r;
0101 }
0102
0103 template<class T1, class T2>
0104 inline bool is_same_object(const T1& l, const T2& r)
0105 {
0106 return range_detail::is_same_address(&l, &r);
0107 }
0108
0109 }
0110
0111 }
0112
0113
0114 #endif