|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77992 - trunk/boost/range
From: neil_at_[hidden]
Date: 2012-04-15 08:18:03
Author: neilgroves
Date: 2012-04-15 08:18:02 EDT (Sun, 15 Apr 2012)
New Revision: 77992
URL: http://svn.boost.org/trac/boost/changeset/77992
Log:
[boost][range] - Ticket 6149 - as_literal causing unnecessary copy (on very silly compilers)
Text files modified:
trunk/boost/range/as_literal.hpp | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
Modified: trunk/boost/range/as_literal.hpp
==============================================================================
--- trunk/boost/range/as_literal.hpp (original)
+++ trunk/boost/range/as_literal.hpp 2012-04-15 08:18:02 EDT (Sun, 15 Apr 2012)
@@ -25,7 +25,7 @@
#include <boost/detail/workaround.hpp>
#include <cstring>
-#ifndef BOOST_NO_CWCHAR
+#ifndef BOOST_NO_CWCHAR
#include <cwchar>
#endif
@@ -38,72 +38,72 @@
return strlen( s );
}
-#ifndef BOOST_NO_CWCHAR
+#ifndef BOOST_NO_CWCHAR
inline std::size_t length( const wchar_t* s )
{
return wcslen( s );
}
-#endif
+#endif
//
// Remark: the compiler cannot choose between T* and T[sz]
// overloads, so we must put the T* internal to the
// unconstrained version.
- //
+ //
inline bool is_char_ptr( char* )
{
return true;
}
-
+
inline bool is_char_ptr( const char* )
{
return true;
}
-#ifndef BOOST_NO_CWCHAR
+#ifndef BOOST_NO_CWCHAR
inline bool is_char_ptr( wchar_t* )
{
return true;
}
-
+
inline bool is_char_ptr( const wchar_t* )
{
return true;
}
#endif
-
+
template< class T >
- inline long is_char_ptr( T /* r */ )
+ inline long is_char_ptr( const T& /* r */ )
{
return 0L;
}
template< class T >
- inline iterator_range<T*>
+ inline iterator_range<T*>
make_range( T* const r, bool )
{
return iterator_range<T*>( r, r + length(r) );
}
template< class T >
- inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<T>::type>
+ inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<T>::type>
make_range( T& r, long )
{
return boost::make_iterator_range( r );
}
}
-
+
template< class Range >
- inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
+ inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
as_literal( Range& r )
{
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
}
template< class Range >
- inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type>
+ inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type>
as_literal( const Range& r )
{
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
@@ -112,9 +112,9 @@
template< class Char, std::size_t sz >
inline iterator_range<Char*> as_literal( Char (&arr)[sz] )
{
- return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
+ return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
}
-
+
template< class Char, std::size_t sz >
inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] )
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk