forked from boostorg/conversion
Performance optimizations and testsfor conversions to/from boost::container::basic_string
[SVN r74940]
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/lcast_precision.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <cwchar>
|
||||
|
||||
|
||||
@@ -145,6 +146,12 @@ namespace boost
|
||||
{
|
||||
typedef CharT type;
|
||||
};
|
||||
|
||||
template<class CharT, class Traits, class Alloc>
|
||||
struct stream_char< ::boost::container::basic_string<CharT,Traits,Alloc> >
|
||||
{
|
||||
typedef CharT type;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
@@ -259,6 +266,24 @@ namespace boost
|
||||
typedef Traits type;
|
||||
};
|
||||
|
||||
template<class CharT, class Traits, class Alloc, class Source>
|
||||
struct deduce_char_traits< CharT
|
||||
, ::boost::container::basic_string<CharT,Traits,Alloc>
|
||||
, Source
|
||||
>
|
||||
{
|
||||
typedef Traits type;
|
||||
};
|
||||
|
||||
template<class CharT, class Target, class Traits, class Alloc>
|
||||
struct deduce_char_traits< CharT
|
||||
, Target
|
||||
, ::boost::container::basic_string<CharT,Traits,Alloc>
|
||||
>
|
||||
{
|
||||
typedef Traits type;
|
||||
};
|
||||
|
||||
template<class CharT, class Traits, class Alloc1, class Alloc2>
|
||||
struct deduce_char_traits< CharT
|
||||
, std::basic_string<CharT,Traits,Alloc1>
|
||||
@@ -267,6 +292,15 @@ namespace boost
|
||||
{
|
||||
typedef Traits type;
|
||||
};
|
||||
|
||||
template<class CharT, class Traits, class Alloc1, class Alloc2>
|
||||
struct deduce_char_traits< CharT
|
||||
, ::boost::container::basic_string<CharT,Traits,Alloc1>
|
||||
, ::boost::container::basic_string<CharT,Traits,Alloc2>
|
||||
>
|
||||
{
|
||||
typedef Traits type;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1257,6 +1291,14 @@ namespace boost
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class Alloc>
|
||||
bool operator<<(::boost::container::basic_string<CharT,Traits,Alloc> const& str)
|
||||
{
|
||||
start = const_cast<CharT*>(str.data());
|
||||
finish = start + str.length();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator<<(bool value)
|
||||
{
|
||||
CharT const czero = lcast_char_constants<CharT>::zero;
|
||||
@@ -1462,6 +1504,9 @@ namespace boost
|
||||
#else
|
||||
template<class Alloc>
|
||||
bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; }
|
||||
|
||||
template<class Alloc>
|
||||
bool operator>>(::boost::container::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; }
|
||||
#endif
|
||||
/*
|
||||
* case "-0" || "0" || "+0" : output = false; return true;
|
||||
@@ -1598,6 +1643,12 @@ namespace boost
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc> >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_char_or_wchar
|
||||
{
|
||||
@@ -1698,6 +1749,18 @@ namespace boost
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc>, CharT* >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc>, const CharT* >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4701 ) // possible use of ... before initialization
|
||||
|
||||
Reference in New Issue
Block a user