forked from boostorg/optional
operator<< improvements
This commit is contained in:
@ -1226,10 +1226,13 @@ get_pointer ( optional<T>& opt )
|
||||
return opt.get_ptr() ;
|
||||
}
|
||||
|
||||
// Forward declaration to prevent operator safe-bool from being used.
|
||||
template<class CharType, class CharTrait, class T>
|
||||
// The following declaration prevents a bug where operator safe-bool is used upon streaming optional object if you forget the IO header.
|
||||
template<class CharType, class CharTrait>
|
||||
std::basic_ostream<CharType, CharTrait>&
|
||||
operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v);
|
||||
operator<<(std::basic_ostream<CharType, CharTrait>& out, optional_detail::optional_tag const& v)
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header <boost/optional/optional_io.hpp>");
|
||||
}
|
||||
|
||||
// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values).
|
||||
// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead.
|
||||
|
@ -16,9 +16,8 @@
|
||||
#include <ostream>
|
||||
|
||||
#include <boost/none.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include "boost/optional/optional.hpp"
|
||||
#include "boost/utility/value_init.hpp"
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
Reference in New Issue
Block a user