3 // Copyright Thorsten Ottosen 2003-2004. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
12 #define BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
14 #include <boost/range/config.hpp>
15 #include <boost/range/detail/common.hpp>
16 #include <boost/type_traits/is_same.hpp>
20 #ifndef BOOST_NO_CWCHAR
26 namespace range_detail
29 inline void boost_range_silence_warning( const T& ) { }
31 /////////////////////////////////////////////////////////////////////
33 /////////////////////////////////////////////////////////////////////
35 inline const char* str_end( const char* s, const char* )
37 return s + strlen( s );
40 #ifndef BOOST_NO_CWCHAR
41 inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
43 return s + wcslen( s );
46 inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
48 if( s == 0 || s[0] == 0 )
56 template< class Char >
57 inline Char* str_end( Char* s )
59 return const_cast<Char*>( str_end( s, s ) );
62 template< class T, std::size_t sz >
63 inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] )
65 return boost_range_array + sz;
68 template< class T, std::size_t sz >
69 inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
71 return boost_range_array + sz;
74 /////////////////////////////////////////////////////////////////////
76 /////////////////////////////////////////////////////////////////////
78 template< class Char >
79 inline std::size_t str_size( const Char* const& s )
81 return str_end( s ) - s;
84 template< class T, std::size_t sz >
85 inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] )
87 boost_range_silence_warning( boost_range_array );
91 template< class T, std::size_t sz >
92 inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] )
94 boost_range_silence_warning( boost_range_array );
98 } // namespace 'range_detail'
100 } // namespace 'boost'