forked from boostorg/conversion
overloading fix + less permissive wide character support
[SVN r17893]
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
#ifndef BOOST_LEXICAL_CAST_INCLUDED
|
||||
#define BOOST_LEXICAL_CAST_INCLUDED
|
||||
|
||||
// boost lexical_cast.hpp header --------------------------------------------//
|
||||
|
||||
// See http://www.boost.org/libs/conversion for documentation.
|
||||
// Boost lexical_cast.hpp header -------------------------------------------//
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
// See end of this header for rights and permissions.
|
||||
//
|
||||
// what: lexical_cast custom keyword cast
|
||||
// who: contributed by Kevlin Henney,
|
||||
// enhanced with contributions from Terje Slettebø,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Dave Abrahams, Daryle Walker, and other Boosters on the list
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, and other Boosters
|
||||
// when: November 2000, March 2003
|
||||
|
||||
#include <string>
|
||||
@@ -25,6 +25,12 @@
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STRINGSTREAM) || \
|
||||
defined(BOOST_NO_STD_WSTRING) || \
|
||||
defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
#define DISABLE_WIDE_CHAR_SUPPORT
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// exception used to indicate runtime lexical_cast failure
|
||||
@@ -69,7 +75,7 @@ namespace boost
|
||||
typedef char type;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_STRINGSTREAM
|
||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
||||
template<>
|
||||
struct stream_char<wchar_t>
|
||||
{
|
||||
@@ -88,7 +94,6 @@ namespace boost
|
||||
typedef wchar_t type;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<>
|
||||
struct stream_char<std::wstring>
|
||||
{
|
||||
@@ -96,8 +101,6 @@ namespace boost
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
template<typename TargetChar, typename SourceChar>
|
||||
struct widest_char
|
||||
{
|
||||
@@ -143,11 +146,16 @@ namespace boost
|
||||
stream >> output &&
|
||||
(stream >> std::ws).eof();
|
||||
}
|
||||
template<typename Char, typename Traits, typename Allocator>
|
||||
bool operator>>(std::basic_string<Char, Traits, Allocator> &output)
|
||||
bool operator>>(std::string &output)
|
||||
{
|
||||
return std::getline(stream, output, char_type()).eof();
|
||||
}
|
||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
||||
bool operator>>(std::wstring &output)
|
||||
{
|
||||
return std::getline(stream, output, char_type()).eof();
|
||||
}
|
||||
#endif
|
||||
private:
|
||||
typedef typename widest_char<
|
||||
typename stream_char<Target>::type,
|
||||
@@ -181,4 +189,5 @@ namespace boost
|
||||
//
|
||||
// This software is provided "as is" without express or implied warranty.
|
||||
|
||||
#undef DISABLE_WIDE_CHAR_SUPPORT
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user