Add a forward declaration of the ostream operator for optional. Fixes #2103.

[SVN r82930]
This commit is contained in:
Steven Watanabe
2013-02-16 19:32:20 +00:00
committed by Andrzej Krzemienski
parent 8d6f6ddf4f
commit 60f3efc852

View File

@ -17,6 +17,7 @@
#include <new> #include <new>
#include <algorithm> #include <algorithm>
#include <iosfwd>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
@ -717,6 +718,11 @@ get_pointer ( optional<T>& opt )
return opt.get_ptr() ; return opt.get_ptr() ;
} }
// Forward declaration to prevent operator safe-bool from being used.
template<class CharType, class CharTrait, class T>
std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v);
// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). // optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values).
// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. // WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead.