update boost
This commit is contained in:
@@ -26,6 +26,10 @@
|
||||
// STL
|
||||
#include <string>
|
||||
|
||||
#if defined(BOOST_TEST_STRING_VIEW)
|
||||
#include <string_view>
|
||||
#endif
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -166,6 +170,30 @@ private:
|
||||
static CharT null;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** cstring_string_view_helper ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
|
||||
#if defined(BOOST_TEST_STRING_VIEW)
|
||||
// Helper for instanciating a subclass of cstring using a string_view. We do not
|
||||
// change the API of cstring using BOOST_TEST_STRING_VIEW as the code should remain
|
||||
// compatible between boost.test and test module using different compiler options.
|
||||
//! @internal
|
||||
template <class CharT, class string_view_t = std::basic_string_view<CharT>>
|
||||
class BOOST_SYMBOL_VISIBLE stringview_cstring_helper : public basic_cstring<CharT> {
|
||||
public:
|
||||
stringview_cstring_helper(string_view_t const& sv)
|
||||
: basic_cstring<CharT>(const_cast<CharT*>(sv.data()), sv.size())
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** basic_cstring::impl ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename CharT>
|
||||
@@ -373,17 +401,22 @@ template<typename CharT>
|
||||
inline basic_cstring<CharT>&
|
||||
basic_cstring<CharT>::trim_right( basic_cstring exclusions )
|
||||
{
|
||||
if(!size()) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
if( exclusions.is_empty() )
|
||||
exclusions = default_trim_ex();
|
||||
|
||||
iterator it;
|
||||
iterator it = end();
|
||||
|
||||
for( it = end()-1; it != begin()-1; --it ) {
|
||||
do {
|
||||
--it;
|
||||
if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
|
||||
break;
|
||||
}
|
||||
} while(it != begin());
|
||||
|
||||
return trim_right( it+1 );
|
||||
return trim_right( it + 1 );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -515,19 +548,16 @@ inline typename basic_cstring<CharT>::size_type
|
||||
basic_cstring<CharT>::find( basic_cstring<CharT> str ) const
|
||||
{
|
||||
if( str.is_empty() || str.size() > size() )
|
||||
return static_cast<size_type>(npos);
|
||||
return npos;
|
||||
|
||||
const_iterator it = begin();
|
||||
const_iterator last = end() - str.size() + 1;
|
||||
|
||||
while( it != last ) {
|
||||
for( const_iterator it = begin(); it != last; ++it ) {
|
||||
if( traits_type::compare( it, str.begin(), str.size() ) == 0 )
|
||||
break;
|
||||
|
||||
++it;
|
||||
return static_cast<size_type>(it - begin());
|
||||
}
|
||||
|
||||
return it == last ? npos : static_cast<size_type>(it - begin());
|
||||
return npos;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -537,19 +567,18 @@ inline typename basic_cstring<CharT>::size_type
|
||||
basic_cstring<CharT>::rfind( basic_cstring<CharT> str ) const
|
||||
{
|
||||
if( str.is_empty() || str.size() > size() )
|
||||
return static_cast<size_type>(npos);
|
||||
return npos;
|
||||
|
||||
const_iterator it = end() - str.size();
|
||||
const_iterator last = begin()-1;
|
||||
const_iterator first = begin();
|
||||
|
||||
while( it != last ) {
|
||||
for( const_iterator it = end() - str.size(); it != first; --it ) {
|
||||
if( traits_type::compare( it, str.begin(), str.size() ) == 0 )
|
||||
break;
|
||||
|
||||
--it;
|
||||
return static_cast<size_type>(it - begin());
|
||||
}
|
||||
|
||||
return it == last ? static_cast<size_type>(npos) : static_cast<size_type>(it - begin());
|
||||
if( traits_type::compare( first, str.begin(), str.size() ) == 0 )
|
||||
return static_cast<size_type>(0);
|
||||
else
|
||||
return npos;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <boost/test/detail/config.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace unit_test {
|
||||
@@ -32,6 +33,12 @@ typedef const_string const literal_string;
|
||||
|
||||
typedef char const* const c_literal_string;
|
||||
|
||||
#if defined(BOOST_TEST_STRING_VIEW)
|
||||
template <class CharT, class string_view_t>
|
||||
class BOOST_SYMBOL_VISIBLE stringview_cstring_helper;
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace unit_test
|
||||
|
||||
} // namespace boost
|
||||
|
||||
@@ -39,7 +39,7 @@ template<typename CharT> struct bcs_base_char { typedef CharT type; };
|
||||
|
||||
template<> struct bcs_base_char<char const> { typedef char type; };
|
||||
template<> struct bcs_base_char<unsigned char> { typedef char type; };
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
|
||||
template<> struct bcs_base_char<unsigned char const> { typedef char type; };
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@ template<> struct bcs_base_char<wchar_t const> { typedef wchar_t type;
|
||||
template<typename CharT>
|
||||
struct bcs_char_traits_impl
|
||||
{
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
typedef CharT const const_char;
|
||||
#else
|
||||
typedef typename boost::add_const<CharT>::type const_char;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
# if defined(BOOST_NO_STDC_NAMESPACE) && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570)
|
||||
# if defined(BOOST_NO_STDC_NAMESPACE) && !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x570)
|
||||
namespace std { using ::toupper; }
|
||||
# endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user