summaryrefslogtreecommitdiff
path: root/boost/optional/optional_io.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-03-21 06:45:20 (GMT)
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-03-21 06:46:37 (GMT)
commit733b5d5ae2c5d625211e2985ac25728ac3f54883 (patch)
treea5b214744b256f07e1dc2bd7273035a7808c659f /boost/optional/optional_io.hpp
parent08c1e93fa36a49f49325a07fe91ff92c964c2b6c (diff)
downloadboost-733b5d5ae2c5d625211e2985ac25728ac3f54883.zip
boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.gz
boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.bz2
Imported Upstream version 1.58.0upstream/1.58.0refs/changes/33/62933/1
Change-Id: If0072143aa26874812e0db6872e1efb10a3e5e94 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/optional/optional_io.hpp')
-rw-r--r--boost/optional/optional_io.hpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/boost/optional/optional_io.hpp b/boost/optional/optional_io.hpp
index 4c1c610..16dbf95 100644
--- a/boost/optional/optional_io.hpp
+++ b/boost/optional/optional_io.hpp
@@ -16,21 +16,33 @@
#include <ostream>
#include <boost/none.hpp>
-#include <boost/assert.hpp>
#include "boost/optional/optional.hpp"
-#include "boost/utility/value_init.hpp"
+
namespace boost
{
+template<class CharType, class CharTrait>
+inline
+std::basic_ostream<CharType, CharTrait>&
+operator<<(std::basic_ostream<CharType, CharTrait>& out, none_t const&)
+{
+ if (out.good())
+ {
+ out << "--";
+ }
+
+ return out;
+}
+
template<class CharType, class CharTrait, class T>
inline
std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v)
{
- if ( out.good() )
+ if (out.good())
{
- if ( !v )
+ if (!v)
out << "--" ;
else out << ' ' << *v ;
}
@@ -50,7 +62,11 @@ operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v)
{
T x;
in >> x;
+#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
+ v = boost::move(x);
+#else
v = x;
+#endif
}
else
{