diff --git a/doc/00_optional.qbk b/doc/00_optional.qbk index 2f940b7..28532de 100644 --- a/doc/00_optional.qbk +++ b/doc/00_optional.qbk @@ -2,7 +2,7 @@ [quickbook 1.4] [authors [Cacciola Carballal, Fernando Luis]] [copyright 2003-2007 Fernando Luis Cacciola Carballal] - [copyright 2014 Andrzej Krzemieński] + [copyright 2014-2015 Andrzej Krzemieński] [category miscellaneous] [id optional] [dirname optional] @@ -80,12 +80,13 @@ This is how you solve it with `boost::optional`: [include 11_development.qbk] [include 12_when_to_use.qbk] [include 13_relational_operators.qbk] -[include 14_optional_references.qbk] -[include 15_in_place_factories.qbk] -[include 16_optional_bool.qbk] -[include 17_exception_safety.qbk] -[include 18_type_requirements.qbk] -[include 19_on_performance.qbk] +[include 14_io.qbk] +[include 15_optional_references.qbk] +[include 16_in_place_factories.qbk] +[include 17_optional_bool.qbk] +[include 18_exception_safety.qbk] +[include 19_type_requirements.qbk] +[include 1A_on_performance.qbk] [endsect] [section Reference] [include 20_reference.qbk] diff --git a/doc/14_io.qbk b/doc/14_io.qbk new file mode 100644 index 0000000..0fb4e89 --- /dev/null +++ b/doc/14_io.qbk @@ -0,0 +1,37 @@ + +[section IO operators] + +It is possible to use `optional` with IO streams, provided that `T` can be used with streams. IOStream operators are defined in a separate header. + +`` +#include +#include + +int main() +{ + boost::optional o1 = 1, oN = boost::none; + std::cout << o1; + std::cin >> oN; +} +`` + +The current implementation does not guarantee any particular output. What it guarantees is that if streaming out and then back in `T` gives the same value, then streaming out and then back in `optional` will also give back the same result: + +`` +#include +#include +#include + +int main() +{ + boost::optional o1 = 1, oN = boost::none; + boost::optional x1, x2; + std::stringstream s; + s << o1 << oN; + s >> x1 >> x2; + assert (o1 == x1); + assert (oN == x2); +} +`` + +[endsect] diff --git a/doc/14_optional_references.qbk b/doc/15_optional_references.qbk similarity index 100% rename from doc/14_optional_references.qbk rename to doc/15_optional_references.qbk diff --git a/doc/15_in_place_factories.qbk b/doc/16_in_place_factories.qbk similarity index 100% rename from doc/15_in_place_factories.qbk rename to doc/16_in_place_factories.qbk diff --git a/doc/16_optional_bool.qbk b/doc/17_optional_bool.qbk similarity index 100% rename from doc/16_optional_bool.qbk rename to doc/17_optional_bool.qbk diff --git a/doc/17_exception_safety.qbk b/doc/18_exception_safety.qbk similarity index 100% rename from doc/17_exception_safety.qbk rename to doc/18_exception_safety.qbk diff --git a/doc/18_type_requirements.qbk b/doc/19_type_requirements.qbk similarity index 100% rename from doc/18_type_requirements.qbk rename to doc/19_type_requirements.qbk diff --git a/doc/19_on_performance.qbk b/doc/1A_on_performance.qbk similarity index 100% rename from doc/19_on_performance.qbk rename to doc/1A_on_performance.qbk diff --git a/doc/91_relnotes.qbk b/doc/91_relnotes.qbk index 94a9c61..666571c 100644 --- a/doc/91_relnotes.qbk +++ b/doc/91_relnotes.qbk @@ -14,6 +14,8 @@ [heading Boost Release 1.58] * `boost::none_t` is no longer convertible from literal `0`. This avoids a bug where `optional> oi = 0;` would initialize an optional object with no contained value. +* Improved the trick that prevents streaming out `optional` without header `optional_io.hpp` by using safe-bool idiom. This addresses [@https://svn.boost.org/trac/boost/ticket/10825 Trac #10825] +* IOStream operators are now mentioned in documentation. [heading Boost Release 1.57] diff --git a/doc/html/boost_optional/acknowledgements.html b/doc/html/boost_optional/acknowledgements.html index 9c8019a..d025d50 100644 --- a/doc/html/boost_optional/acknowledgements.html +++ b/doc/html/boost_optional/acknowledgements.html @@ -116,7 +116,7 @@ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-PrevUpHomeNext +PrevUpHomeNext

@@ -101,7 +101,7 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/tutorial/performance_considerations.html b/doc/html/boost_optional/tutorial/performance_considerations.html index d054e01..2e2d4ca 100644 --- a/doc/html/boost_optional/tutorial/performance_considerations.html +++ b/doc/html/boost_optional/tutorial/performance_considerations.html @@ -209,7 +209,7 @@
-
-