forked from boostorg/optional
Non-templated iostreams fix in optional_io
Better "illegal conversion" fail test [SVN r32972]
This commit is contained in:
@ -12,8 +12,18 @@
|
||||
#ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
|
||||
#define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
|
||||
|
||||
#include<ostream>
|
||||
#include<istream>
|
||||
# if defined __GNUC__
|
||||
# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97)
|
||||
#define BOOST_OPTIONAL_NO_TEMPLATED_STREAMS
|
||||
#endif
|
||||
#endif // __GNUC__
|
||||
|
||||
#if defined BOOST_OPTIONAL_NO_TEMPLATED_STREAMS
|
||||
#include <iostream>
|
||||
#else
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#endif
|
||||
|
||||
|
||||
#include "boost/optional/optional.hpp"
|
||||
@ -22,10 +32,15 @@
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#if defined (BOOST_NO_TEMPLATED_STREAMS)
|
||||
template<class T>
|
||||
inline std::ostream& operator<<(std::ostream& out, optional<T> const& v)
|
||||
#else
|
||||
template<class CharType, class CharTrait, class T>
|
||||
inline
|
||||
std::basic_ostream<CharType, CharTrait>&
|
||||
operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v)
|
||||
#endif
|
||||
{
|
||||
if ( out.good() )
|
||||
{
|
||||
@ -37,10 +52,15 @@ operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v)
|
||||
return out;
|
||||
}
|
||||
|
||||
#if defined (BOOST_NO_TEMPLATED_STREAMS)
|
||||
template<class T>
|
||||
inline std::istream& operator>>(std::istream& in, optional<T>& v)
|
||||
#else
|
||||
template<class CharType, class CharTrait, class T>
|
||||
inline
|
||||
std::basic_istream<CharType, CharTrait>&
|
||||
operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v)
|
||||
#else
|
||||
{
|
||||
if ( in.good() )
|
||||
{
|
||||
|
Reference in New Issue
Block a user