fixed missing references on char* arguments

[SVN r25090]
This commit is contained in:
Thorsten Jørgen Ottosen
2004-09-14 21:24:20 +00:00
parent bd13c9082e
commit e6611aafb1
7 changed files with 32 additions and 29 deletions

View File

@ -84,22 +84,22 @@ namespace range_detail
// string // string
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
inline const char* begin( const char* s ) inline const char* begin( const char*& s )
{ {
return s; return s;
} }
inline char* begin( char* s ) inline char* begin( char*& s )
{ {
return s; return s;
} }
inline const wchar_t* begin( const wchar_t* s ) inline const wchar_t* begin( const wchar_t*& s )
{ {
return s; return s;
} }
inline wchar_t* begin( wchar_t* s ) inline wchar_t* begin( wchar_t*& s )
{ {
return s; return s;
} }

View File

@ -52,7 +52,7 @@ namespace boost
#endif #endif
template< typename Char > template< typename Char >
inline Char* str_end( Char* s ) inline Char* str_end( Char* const& s )
{ {
return (Char*)str_end( s, s ); return (Char*)str_end( s, s );
} }
@ -106,7 +106,7 @@ namespace boost
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
template< typename Char > template< typename Char >
inline std::size_t str_size( const Char* s ) inline std::size_t str_size( const Char* const& s )
{ {
return str_end( s ) - s; return str_end( s ) - s;
} }
@ -138,7 +138,8 @@ namespace boost
template< typename T, std::size_t sz > template< typename T, std::size_t sz >
inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] ) inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] )
{ {
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same<const char,T>::value || is_same<const wchar_t,T>::value ||
is_same<char,T>::value || is_same<wchar_t,T>::value,
char_or_wchar_t_array_tag, char_or_wchar_t_array_tag,
int >::type tag; int >::type tag;
return array_size<T,sz>( array, tag() ); return array_size<T,sz>( array, tag() );

View File

@ -28,8 +28,8 @@ namespace boost
// string // string
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
yes_type is_string_impl( const char* ); yes_type is_string_impl( const char* const );
yes_type is_string_impl( const wchar_t* ); yes_type is_string_impl( const wchar_t* const );
no_type is_string_impl( ... ); no_type is_string_impl( ... );
template< std::size_t sz > template< std::size_t sz >
@ -44,16 +44,16 @@ namespace boost
yes_type is_wchar_t_array_impl( const wchar_t BOOST_RANGE_ARRAY_REF()[sz] ); yes_type is_wchar_t_array_impl( const wchar_t BOOST_RANGE_ARRAY_REF()[sz] );
no_type is_wchar_t_array_impl( ... ); no_type is_wchar_t_array_impl( ... );
yes_type is_char_ptr_impl( char* ); yes_type is_char_ptr_impl( char* const );
no_type is_char_ptr_impl( ... ); no_type is_char_ptr_impl( ... );
yes_type is_const_char_ptr_impl( const char* ); yes_type is_const_char_ptr_impl( const char* const );
no_type is_const_char_ptr_impl( ... ); no_type is_const_char_ptr_impl( ... );
yes_type is_wchar_t_ptr_impl( wchar_t* ); yes_type is_wchar_t_ptr_impl( wchar_t* const );
no_type is_wchar_t_ptr_impl( ... ); no_type is_wchar_t_ptr_impl( ... );
yes_type is_const_wchar_t_ptr_impl( const wchar_t* ); yes_type is_const_wchar_t_ptr_impl( const wchar_t* const );
no_type is_const_wchar_t_ptr_impl( ... ); no_type is_const_wchar_t_ptr_impl( ... );
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -42,12 +42,12 @@ namespace range_detail
// string // string
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
inline bool empty( const char* s ) inline bool empty( const char* const& s )
{ {
return s == 0 || s[0] == 0; return s == 0 || s[0] == 0;
} }
inline bool empty( const wchar_t* s ) inline bool empty( const wchar_t* const& s )
{ {
return s == 0 || s[0] == 0; return s == 0 || s[0] == 0;
} }

View File

@ -84,22 +84,22 @@ namespace range_detail
// string // string
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
inline char* end( char* s ) inline char* end( char*& s )
{ {
return range_detail::str_end( s ); return range_detail::str_end( s );
} }
inline wchar_t* end( wchar_t* s ) inline wchar_t* end( wchar_t*& s )
{ {
return range_detail::str_end( s ); return range_detail::str_end( s );
} }
inline const char* end( const char* s ) inline const char* end( const char*& s )
{ {
return range_detail::str_end( s ); return range_detail::str_end( s );
} }
inline const wchar_t* end( const wchar_t* s ) inline const wchar_t* end( const wchar_t*& s )
{ {
return range_detail::str_end( s ); return range_detail::str_end( s );
} }
@ -119,7 +119,7 @@ inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type end( const T& r )
} }
/*
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// BCB is not able to overload pointer when class overloads are also available // BCB is not able to overload pointer when class overloads are also available
template<> template<>
@ -135,7 +135,7 @@ inline range_const_iterator<const wchar_t*>::type end<const wchar_t*>( const wch
} }
#endif #endif
*/
} // namespace 'boost' } // namespace 'boost'

View File

@ -73,12 +73,12 @@ namespace range_detail
// string // string
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
inline std::size_t size( const char*& s ) inline std::size_t size( const char* const& s )
{ {
return boost::range_detail::str_size( s ); return boost::range_detail::str_size( s );
} }
inline std::size_t size( const wchar_t*& s ) inline std::size_t size( const wchar_t* const& s )
{ {
return boost::range_detail::str_size( s ); return boost::range_detail::str_size( s );
} }
@ -91,21 +91,23 @@ inline BOOST_DEDUCED_TYPENAME range_size<T>::type size( const T& r )
return range_detail::size( r ); return range_detail::size( r );
} }
/*
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// BCB is not able to overload pointer when class overloads are also available // BCB is not able to overload pointer when class overloads are also available
template<> template<>
inline range_size<const char*>::type size<const char*>( const char*& r ) inline range_size<const char*>::type size<const char*>( const char* const& r )
{ {
return range_detail::str_size( r ); return range_detail::str_size( r );
} }
template<> template<>
inline range_size<const wchar_t*>::type size<const wchar_t*>( const wchar_t*& r ) inline range_size<const wchar_t*>::type size<const wchar_t*>( const wchar_t* const& r )
{ {
return range_detail::str_size( r ); return range_detail::str_size( r );
} }
#endif #endif
*/
} // namespace 'boost' } // namespace 'boost'