forked from boostorg/optional
Add operator<< for boost::none
This commit is contained in:
@ -23,6 +23,15 @@
|
|||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template<class CharType, class CharTrait>
|
||||||
|
inline
|
||||||
|
std::basic_ostream<CharType, CharTrait>&
|
||||||
|
operator<<(std::basic_ostream<CharType, CharTrait>& out, none_t const&)
|
||||||
|
{
|
||||||
|
out << "--";
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
template<class CharType, class CharTrait, class T>
|
template<class CharType, class CharTrait, class T>
|
||||||
inline
|
inline
|
||||||
std::basic_ostream<CharType, CharTrait>&
|
std::basic_ostream<CharType, CharTrait>&
|
||||||
|
@ -75,12 +75,22 @@ void test( T v, T w )
|
|||||||
test2( optional<T> () , make_optional(w));
|
test2( optional<T> () , make_optional(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test()
|
||||||
|
{
|
||||||
|
stringstream s ;
|
||||||
|
s << boost::none;
|
||||||
|
BOOST_ASSERT(s.str() == "--");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_main( int, char* [] )
|
int test_main( int, char* [] )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
test(1,2);
|
test(1,2);
|
||||||
test(string("hello"),string("buffer"));
|
test(string("hello"),string("buffer"));
|
||||||
|
test();
|
||||||
}
|
}
|
||||||
catch ( ... )
|
catch ( ... )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user