forked from boostorg/conversion
+119
-19
@@ -247,13 +247,42 @@ namespace boost
|
||||
static void check_coverage() {}
|
||||
};
|
||||
|
||||
// No specializations for:
|
||||
// lcast_src_length<char, signed char>
|
||||
// lcast_src_length<char, unsigned char>
|
||||
// lcast_src_length<char, signed char*>
|
||||
// lcast_src_length<char, unsigned char*>
|
||||
// lcast_src_length<char, signed char const*>
|
||||
// lcast_src_length<char, unsigned char const*>
|
||||
template<>
|
||||
struct lcast_src_length<char, signed char>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, unsigned char>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, signed char*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, unsigned char*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, signed char const*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, unsigned char const*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
|
||||
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
template<>
|
||||
@@ -821,9 +850,13 @@ namespace boost
|
||||
|
||||
bool operator<<(bool);
|
||||
bool operator<<(char);
|
||||
bool operator<<(unsigned char);
|
||||
bool operator<<(signed char);
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
bool operator<<(wchar_t);
|
||||
#endif
|
||||
bool operator<<(unsigned char const*);
|
||||
bool operator<<(signed char const*);
|
||||
bool operator<<(CharT const*);
|
||||
bool operator<<(short);
|
||||
bool operator<<(int);
|
||||
@@ -1050,6 +1083,8 @@ namespace boost
|
||||
}
|
||||
|
||||
bool operator>>(CharT&);
|
||||
bool operator>>(unsigned char&);
|
||||
bool operator>>(signed char&);
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
// This #if is in sync with lcast_streambuf_for_target
|
||||
@@ -1091,6 +1126,34 @@ namespace boost
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
unsigned char ch)
|
||||
{
|
||||
return ((*this) << static_cast<char>(ch));
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
signed char ch)
|
||||
{
|
||||
return ((*this) << static_cast<char>(ch));
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
unsigned char const* ch)
|
||||
{
|
||||
return ((*this) << reinterpret_cast<char const*>(ch));
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
signed char const* ch)
|
||||
{
|
||||
return ((*this) << reinterpret_cast<char const*>(ch));
|
||||
}
|
||||
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
@@ -1256,6 +1319,34 @@ namespace boost
|
||||
return ok;
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
||||
unsigned char& output)
|
||||
{
|
||||
BOOST_STATIC_ASSERT( sizeof(CharT) == sizeof(unsigned char) );
|
||||
bool const ok = (finish - start == 1);
|
||||
if(ok) {
|
||||
CharT out;
|
||||
Traits::assign(out, *start);
|
||||
output = static_cast<signed char>(out);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
||||
signed char& output)
|
||||
{
|
||||
BOOST_STATIC_ASSERT( sizeof(CharT) == sizeof(signed char) );
|
||||
bool const ok = (finish - start == 1);
|
||||
if(ok) {
|
||||
CharT out;
|
||||
Traits::assign(out, *start);
|
||||
output = static_cast<signed char>(out);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
||||
@@ -1312,13 +1403,9 @@ namespace boost
|
||||
struct lcast_streambuf_for_target
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::type_traits::ice_not< is_integral<Target>::value >::value,
|
||||
is_same<Target, signed char>::value,
|
||||
is_same<Target, unsigned char>::value
|
||||
>::value
|
||||
)
|
||||
(
|
||||
::boost::type_traits::ice_not< is_integral<Target>::value >::value
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1472,16 +1559,29 @@ namespace boost
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
* is_xchar_to_xchar<Target, Source>::value is true, when
|
||||
* Target and Souce are the same char types, or when
|
||||
* Target and Souce are char types of the same size.
|
||||
*/
|
||||
template<typename Target, typename Source>
|
||||
struct is_xchar_to_xchar
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(
|
||||
::boost::type_traits::ice_and<
|
||||
is_same<Source,Target>::value,
|
||||
is_char_or_wchar<Target>::value
|
||||
(
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::type_traits::ice_and<
|
||||
is_same<Source,Target>::value,
|
||||
is_char_or_wchar<Target>::value
|
||||
>::value,
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_eq< sizeof(char),sizeof(Target)>::value,
|
||||
::boost::type_traits::ice_eq< sizeof(char),sizeof(Source)>::value,
|
||||
is_char_or_wchar<Target>::value,
|
||||
is_char_or_wchar<Source>::value
|
||||
>::value
|
||||
>::value
|
||||
)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user