From 95c864e119314a2611f283a040294c7c8a234d90 Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Sun, 25 Nov 2007 20:26:14 +0000 Subject: [PATCH 01/36] Cast to base added to avoid a call to the convertir constructor/assignment (see Tickes 1419 and 1420) [SVN r41381] --- include/boost/optional/optional.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 42277ba..ebcf17a 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -516,7 +516,7 @@ class optional : public optional_detail::optional_base // Creates a deep copy of another optional // Can throw if T::T(T const&) does - optional ( optional const& rhs ) : base(rhs) {} + optional ( optional const& rhs ) : base( static_cast(rhs) ) {} // No-throw (assuming T::~T() doesn't) ~optional() {} @@ -550,7 +550,7 @@ class optional : public optional_detail::optional_base // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) optional& operator= ( optional const& rhs ) { - this->assign( rhs ) ; + this->assign( static_cast(rhs) ) ; return *this ; } From 3e33d4a200c9654e80e0349f7645d46345107c3b Mon Sep 17 00:00:00 2001 From: Matias Capeletto Date: Thu, 14 Feb 2008 17:43:52 +0000 Subject: [PATCH 02/36] optional docs fixes [SVN r43247] --- doc/Jamfile.v2 | 6 +- .../a_note_about_optional_bool_.html | 26 +- doc/html/boost_optional/acknowledgments.html | 30 +- .../dependencies_and_portability.html | 26 +- .../boost_optional/detailed_semantics.html | 74 +- doc/html/boost_optional/development.html | 45 +- doc/html/boost_optional/examples.html | 26 +- .../exception_safety_guarantees.html | 28 +- .../boost_optional/implementation_notes.html | 26 +- .../boost_optional/in_place_factories.html | 26 +- .../boost_optional/optional_references.html | 26 +- ...for_assignment_of_optional_references.html | 28 +- doc/html/boost_optional/synopsis.html | 26 +- .../boost_optional/type_requirements.html | 26 +- doc/html/images/callouts/1.png | Bin 391 -> 0 bytes doc/html/images/callouts/10.png | Bin 485 -> 0 bytes doc/html/images/callouts/11.png | Bin 410 -> 0 bytes doc/html/images/callouts/12.png | Bin 488 -> 0 bytes doc/html/images/callouts/13.png | Bin 509 -> 0 bytes doc/html/images/callouts/14.png | Bin 499 -> 0 bytes doc/html/images/callouts/15.png | Bin 507 -> 0 bytes doc/html/images/callouts/2.png | Bin 446 -> 0 bytes doc/html/images/callouts/3.png | Bin 431 -> 0 bytes doc/html/images/callouts/4.png | Bin 441 -> 0 bytes doc/html/images/callouts/5.png | Bin 423 -> 0 bytes doc/html/images/callouts/6.png | Bin 431 -> 0 bytes doc/html/images/callouts/7.png | Bin 397 -> 0 bytes doc/html/images/callouts/8.png | Bin 434 -> 0 bytes doc/html/images/callouts/9.png | Bin 420 -> 0 bytes doc/html/images/caution.png | Bin 4286 -> 0 bytes doc/html/images/home.png | Bin 1105 -> 0 bytes doc/html/images/important.png | Bin 4666 -> 0 bytes doc/html/images/next.png | Bin 768 -> 0 bytes doc/html/images/note.png | Bin 4648 -> 0 bytes doc/html/images/prev.png | Bin 741 -> 0 bytes doc/html/images/tip.png | Bin 3902 -> 0 bytes doc/html/images/up.png | Bin 766 -> 0 bytes doc/html/images/warning.png | Bin 3927 -> 0 bytes doc/html/index.html | 41 +- doc/optional.html | 1803 ----------------- doc/optional.qbk | 5 - doc/reference.qbk | 1 + 42 files changed, 265 insertions(+), 2004 deletions(-) delete mode 100644 doc/html/images/callouts/1.png delete mode 100644 doc/html/images/callouts/10.png delete mode 100644 doc/html/images/callouts/11.png delete mode 100644 doc/html/images/callouts/12.png delete mode 100644 doc/html/images/callouts/13.png delete mode 100644 doc/html/images/callouts/14.png delete mode 100644 doc/html/images/callouts/15.png delete mode 100644 doc/html/images/callouts/2.png delete mode 100644 doc/html/images/callouts/3.png delete mode 100644 doc/html/images/callouts/4.png delete mode 100644 doc/html/images/callouts/5.png delete mode 100644 doc/html/images/callouts/6.png delete mode 100644 doc/html/images/callouts/7.png delete mode 100644 doc/html/images/callouts/8.png delete mode 100644 doc/html/images/callouts/9.png delete mode 100755 doc/html/images/caution.png delete mode 100755 doc/html/images/home.png delete mode 100755 doc/html/images/important.png delete mode 100755 doc/html/images/next.png delete mode 100755 doc/html/images/note.png delete mode 100755 doc/html/images/prev.png delete mode 100755 doc/html/images/tip.png delete mode 100755 doc/html/images/up.png delete mode 100755 doc/html/images/warning.png delete mode 100644 doc/optional.html diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 95574ce..abdaf20 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -21,8 +21,10 @@ boostbook standalone : optional : - toc.max.depth=1 - toc.section.depth=1 + boost.root=../../../.. + boost.libraries=../../../libraries.htm + toc.max.depth=2 + toc.section.depth=2 chunk.section.depth=1 ; diff --git a/doc/html/boost_optional/a_note_about_optional_bool_.html b/doc/html/boost_optional/a_note_about_optional_bool_.html index 42d69df..5191d1d 100644 --- a/doc/html/boost_optional/a_note_about_optional_bool_.html +++ b/doc/html/boost_optional/a_note_about_optional_bool_.html @@ -12,17 +12,17 @@ Guarantees"> - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -74,11 +74,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/acknowledgments.html b/doc/html/boost_optional/acknowledgments.html index e2cc05a..09e3c71 100644 --- a/doc/html/boost_optional/acknowledgments.html +++ b/doc/html/boost_optional/acknowledgments.html @@ -10,24 +10,24 @@ and Portability"> - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHome +PrevUpHome

- + Pre-formal review

@@ -66,7 +66,7 @@

- + Post-formal review

@@ -112,11 +112,15 @@
- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHome +PrevUpHome
diff --git a/doc/html/boost_optional/dependencies_and_portability.html b/doc/html/boost_optional/dependencies_and_portability.html index ccc0d2c..35ecb80 100644 --- a/doc/html/boost_optional/dependencies_and_portability.html +++ b/doc/html/boost_optional/dependencies_and_portability.html @@ -11,17 +11,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -36,11 +36,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index bbebfd7..ef68023 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -10,17 +10,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -29,36 +29,42 @@

Because T might be of reference type, in the sequel, those entries whose semantic depends on T being of reference type or not will be - distinguished using the following convention: * If the entry reads: optional<T(not a ref)>, the description corresponds only to the - case where T is not of reference - type. * If the entry reads: optional<T&>, - the description corresponds only to the case where T - is of reference type. * If the entry reads: optional<T>, - the description is the same for both cases. + distinguished using the following convention:

+
    +
  • + If the entry reads: optional<T(not + a ref)>, the description + corresponds only to the case where T + is not of reference type. +
  • +
  • + If the entry reads: optional<T&>, + the description corresponds only to the case where T + is of reference type. +
  • +
  • + If the entry reads: optional<T>, + the description is the same for both cases. +
  • +
- + - +
[Note][Note] Note
-

-

-

- The following section contains various assert() which are used only to show the postconditions - as sample code. It is not implied that the type T - must support each particular expression but that if the expression is supported, - the implied condition holds. -

-

-

-

+ The following section contains various assert() which are used only to show the postconditions + as sample code. It is not implied that the type T + must support each particular expression but that if the expression is supported, + the implied condition holds. +

space

- + optional class member functions

@@ -1334,7 +1340,7 @@ space

- + Free functions

@@ -1693,11 +1699,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html index c013432..8d58d8b 100644 --- a/doc/html/boost_optional/development.html +++ b/doc/html/boost_optional/development.html @@ -10,17 +10,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -292,7 +292,7 @@ itself which are supported by a special interface.

- + Lexically-hinted Value Access in the presence of possibly untitialized optional objects: The operators * and -> @@ -357,7 +357,7 @@ incarnated by pointers.

- + Optional<T> as a model of OptionalPointee
@@ -369,19 +369,12 @@

- + - +
[Warning][Warning] Warning
-

-

-

- However, it is particularly important to note that optional<> objects are not pointers. optional<> is not, and does not model, a - pointer. -

-

-

-

+ However, it is particularly important to note that optional<> objects are not pointers. optional<> is not, and does not model, a pointer. +

For instance, optional<> @@ -405,11 +398,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/examples.html b/doc/html/boost_optional/examples.html index 7fdb8c8..7685a73 100644 --- a/doc/html/boost_optional/examples.html +++ b/doc/html/boost_optional/examples.html @@ -10,17 +10,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -141,11 +141,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/exception_safety_guarantees.html b/doc/html/boost_optional/exception_safety_guarantees.html index 6b4ab64..8f6504f 100644 --- a/doc/html/boost_optional/exception_safety_guarantees.html +++ b/doc/html/boost_optional/exception_safety_guarantees.html @@ -12,17 +12,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -116,7 +116,7 @@ }

- + Swap

@@ -130,11 +130,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/implementation_notes.html b/doc/html/boost_optional/implementation_notes.html index 54af9ab..c0225b3 100644 --- a/doc/html/boost_optional/implementation_notes.html +++ b/doc/html/boost_optional/implementation_notes.html @@ -11,17 +11,17 @@ and Portability"> - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -42,11 +42,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/in_place_factories.html b/doc/html/boost_optional/in_place_factories.html index be2ccbf..a972384 100644 --- a/doc/html/boost_optional/in_place_factories.html +++ b/doc/html/boost_optional/in_place_factories.html @@ -12,17 +12,17 @@ optional<bool>"> - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -190,11 +190,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/optional_references.html b/doc/html/boost_optional/optional_references.html index 396dff0..1222a42 100644 --- a/doc/html/boost_optional/optional_references.html +++ b/doc/html/boost_optional/optional_references.html @@ -11,17 +11,17 @@ semantics for assignment of optional references"> - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -72,11 +72,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html index 8906812..5b894aa 100644 --- a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html +++ b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html @@ -11,17 +11,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -75,7 +75,7 @@ assert(b==3);

- + Rationale

@@ -141,11 +141,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/synopsis.html b/doc/html/boost_optional/synopsis.html index 198750e..c128fc6 100644 --- a/doc/html/boost_optional/synopsis.html +++ b/doc/html/boost_optional/synopsis.html @@ -10,17 +10,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -137,11 +137,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/type_requirements.html b/doc/html/boost_optional/type_requirements.html index 8da1a86..0676bf1 100644 --- a/doc/html/boost_optional/type_requirements.html +++ b/doc/html/boost_optional/type_requirements.html @@ -11,17 +11,17 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore

-PrevUpHomeNext +PrevUpHomeNext

@@ -40,11 +40,15 @@

- +
Copyright © 2003 -2007 Fernando Luis Cacciola Carballal

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/images/callouts/1.png b/doc/html/images/callouts/1.png deleted file mode 100644 index 6003ad3af44ecde89a963d5af6a4180217319dfb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 391 zcmeAS@N?(olHy`uVBq!ia0y~yU=UznVBqFpV_;w?d&FzWz`*F|>EaktF{gKeVcsDJ z0oVU;*6~a;Smx2ZrsEQ?ZxM&ygvBnFE?nmtg94rky>!~x8m)3j$<^(USQPg)>&zq; zMi;kRX=V2=&tIr>`d!)XyUpL@9=UmHetuZ+!_#HmOU>-J$pS3-bN!ardIyAF-G1#? z>&)f7E`k#|4sWoP;JM|(l6I_WZ`%~1y>agujE%b%?TB9+mb}(fsxyPFgQGMy*=%;A z(aZyu>`GQPiY$*T-1gu1pAwY3_N%b5cB#xoiRPn8jf*q{Trb|_a%sui&dtzin6_r? zu}%d~p(mAmOGTO#c2u;xJ(}Y^?ex>t7XL(?7U+1p1hOa|ab;w%c)sCoo@_(^WX<=s zr#89B91nl^w~jx#=XQ?S<*?OXYm`>JmO9g8;`^U+STt2<{M7jt yFTo&UT%Db3I{*CoWB+`guig6oxB?on>HF_suX>mE-_|+p)}_VbyG%XWRxDs!Bbdb`rSkCf z_opQpQ)e&z9?Q3;X^2drllMU70&71c8CwuJm{abIp zeHPuYNTZJ3@x#oHxOW1*hRe1@t$mhYkYRMp!NudU$f{L`HtEbcpPpkT-Q%WwW82?% zC04fVjt$l>J1E5m&cv;Mo-ym249h`b!OT;yI|^kU z7g#)~+Iz@=rzNo?Z+rL2lqSFB&0ni{FPmfwyfr;gD5K)Z38R1FYejhuGSfQP|hTIvQJ?m5M8zE|_KJ2Ny0Fm1o>%kU%6J0MhalaBNL z`|XP~Ht29?&a!*3EqAew_mM&!z3HdD7hn7l!t9~x=u!|XzH8m#&o*bC7c(?GuT1E< zIxY74U)KBI?en(Zj`8vg@_IC9@{~!dRw-$!in=2h%i uo%h^T#Pz@K#3`Fjeg5EaktF{gFX#;)5A z0&V{%irr-ME}D3(<3UjG?A^;f=DTxNc8JvRJ?~omN$9208L_ft0gE{24F|>2&Q_(X zyZRk}S@Y!IJLwtuX$cuSW9kad-E9>}+B4ar@B8JKU&IA}ZdvzvdHazWz|5Z1g ze)`Eh`){a=Ty&?>q6`CxFY1#$=XWS5S;+8pJeF8|am8VmFNNE0pWSjTLp3m4UCF?B z)v7}^cJ1H)wSBfZUSXp*CCGT~*L1 z!O^woK;8cKATG~IcM5iAPD}l8PyF`VZ_(}ou7b0cInG+vv8ev~-ZX{}_a4{SRWsNx zp57$DG;5jTyyy8w3^D7&C6fPqtf+bOwJP3cC`GVy&NA$7e!FZ3*ZX_(gMKMn{jgqg*t>n5-mVwdc+LxmI|e9UlrZu5 zQ({_ROHtjRNV$1z%lk=bT+YJ`-QVnLY|jT_oBf)`qRPnx(gN%Xx|4tEMdaVwoi3 z8lgAcLau*<4)^ratatOor+TqI{wNVS?clathJwW!uZ)j$%&5q+Ew{P&-MZ_q|3(_ifRH$!b{%@XfPPgvO) wR!x~yId8sr_tEzopr0G&e8k^lez diff --git a/doc/html/images/callouts/13.png b/doc/html/images/callouts/13.png deleted file mode 100644 index 5b41e02a670f020ae62b7854482c4ba1980d73cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 509 zcmeAS@N?(olHy`uVBq!ia0y~yU=UznVBqFpV_;w?d&FzWz`%IK)5S5QVovKN`}4B` zMA$w&XL9s;aOlF(1%)YvneO4jm-o(&U;MKD#e?Mq8+>b)^R3G((>5$`ILflv=tsMT zqri^uWh?XJrteF)Ir(#L@uYSZ#}5m2PWL-;h`yh)YSr?%_21hCg6ylJ<~^TZ68k@M z*0PUs0U}2m4Zrz%{ru!$;?!{|$E-JRd$xd+!qOu@YuZ+=+K?-K{IOu7#Gy?(C029K zJuHwgKK8+3O1mEi<8zsP?~|?OE?SqZ;@R}Hh*OcJN#Q`=cIVYsi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@^R!^go|6uIuQi$NDW>upBo%&=x}fma9VINW5Ly|Qkmm3JvHr(Hb1rr&)I%k zqW}1XsO0Up4@Uid#O=~jwU>`!u0>yZkk=jF7J(OKyBQi3I1HqEAMAR!+FC^5{Aa5( zf1b8B8nUgv%H`5>GKER;h_=JWcU60(815ha{H$oF%dBM*eC_{b&TZl;l$m|{>8A+2 z>GpSd7ik$I?GB%onzMHA^lP*F zk0)=tnX|7g@rLFCKI7=6AyTdvVl+z`(%Z>FVdQ I&MBb@0M`i8D*ylh diff --git a/doc/html/images/callouts/3.png b/doc/html/images/callouts/3.png deleted file mode 100644 index 3ff0a93931515bb97a045dfa61a8530d87e458fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 431 zcmeAS@N?(olHy`uVBq!ia0y~yU=UznVBqFpV_;w?d&FzWz`$7M>EaktF{gFH*{(+p zB5wOOu6l7m)8 z=-oKUH}V^&iJyB|uo8LF()AHB5)-MfO`N3nt zvX}OXM~sd8*9*0GtV!A!kzpdmy4F;zn{|?kqeR<^5G@5I1_ong&q>Sg=9!B)JHv7pU)=hauMINB3;oaL&ye>}mU!H{id4Bxig=9%^>^=*s?64R8I`k2o? pd-p8Ef~{sjr?y8+Fx+F*x_2OD_kw447#J8BJYD@<);T3K0RY@Tw*mkF diff --git a/doc/html/images/callouts/4.png b/doc/html/images/callouts/4.png deleted file mode 100644 index 6aa29fc0b48c17aa6ce5540e1af5c00510c33ff7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 441 zcmeAS@N?(olHy`uVBq!ia0y~yU=UznVBqFpV_;w?d&FzWz`)qx>EaktF{gFH#x5mC zfwup%GG$o)=ergqP)_hu?Cbmc-FuV6=PTSkE z?z;W`K`XyJWKnY38^_LI-}iXo6rn{K^Ugm{NGsVLTQQIQc;ScrMIF~}*~{?xZ|}UC z)%voeOU2Vbu7Bb(%{5!g=daxAHc3V5z+>?E76HlSc>&q{{ zJgU5>EY^K=``x_dYqp*_vnNK+lE-=9auZ+6u0=XLho7HKd(8afJ98Qv1B>H_g?h*I z^7xt(_!*jJt_^x6<$Ce%iJd)$VVYl~OqdVEFZF#=7-s1t%fP_E;OXk;vd$@?2>|9n B#bp2h diff --git a/doc/html/images/callouts/5.png b/doc/html/images/callouts/5.png deleted file mode 100644 index 36e785867ad9b06bb5da296fee61b67cd8159ded..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 423 zcmeAS@N?(olHy`uVBq!ia0y~yU=UznVBqFpV_;w?d&FzWz`&U2>EaktF{gFn*{nkj zBCY4o9LZ47@QCRUnZAf+N!}-g*k62kUh<2$=N}3cU-wJsu7~Tf`D?j51GwEfg_G2_ zuV#t97&qf=>*tSit#h_USr*FJFU!>WaGpbPU+ne2DLtw;&jomW^|@TLId}ILd4;Y; z`kGI<1$&J<4oW?f4p9*ch$x|rP+;KqSwET0Ksa~vKtM(>J91HOJ>EhB>xN^tsw+8di7uv`rMqUeL zJtlGLsS$%o&3$<<&56<(YY$o;PcU%UfB(F1o@3V5sOFBi;${Vo2fOrSjvstkva9-x zil;zZBGUt9^BXy4GknxI4hvj-p!#HTV6S6ePsEk3N^VkheYYwwc>v z!48gj&!5^CXy3`&YF5dr$YOKedHr?gg#ir$OfFx%f9Fdu@F;mr4Z2vhci-*k?73P? f@97_A_`n?SY~RWh)zCHu1_lOCS3j3^P6EaktF{gFH{#8D;%7vjax1W#KXIAnv(J`n z&5VyM+63~m6_r{NIT!+`rAn_gmE-I&+!3QUA?T1q^ClfZ7RG!2%96cqg2wgyaq?lS zMX$X!U8LbO@45W6mvfv$L-`J@Z+FmS&DLGD$|-VMfY)E~efQs=*mUM;<-bcWOZM5Z zTz)B%D3P@Lt`d*4kJ{wr1(Q_jEaktF{gLJ{wyX( zf%f{%yMM5|1Qs>DxO#n#YtRpleGYL4%{eMNMC?4cR!{jhN$+gat*(bhBwQW8eR)?F zba$a+^0L_vzt^7O@l~6=`|-z${Iyee1O}bTzyIC7L&Goql*H!=r=P}oFAaJ)O@ZgI z{@Sm`#{5B@N=kt`V%+OqiyeDxcc)!#?*L7k5+eADVIg?*L>hpfK3x*)1hCVBt; z;|%wV8@Gym{wcFIjN7SWb%BU0N0Y+6yzR|3cK@fSPF7(wKKyx4{o#4fYt#Iv1TDJ# z*2#-AZQqV>`4S8w#?i?>7PHU(+hgr1l-*Nl-OBiY{af+c^=0Sh`7EaktF{kyy#=ct) z0&EZJryZ5xyvdOv(510`p{HDvlxC~E$|>iVgULHQ3PYvrom?h2P4(>+k=FEToVfLb z-1}ul4-dV}J2m&O{aGGazV^u2>+);2+U^P78~6Tv*4AI1E_e2NCZAD1|9M}poAQ6# z2UUCjU5lzOJ!f0qp`v6c!}s@T(aY_*-6p<)(^RJf%{ZH;pv2Hn%$FKjXEE0=dabFI zOUbTczTJ2ED(5xNoT$P%L(+vssY!q-Q6kB1zW$Oa(QCh^Kc6#2_JRrTx8JslG@1mM zBBvdU`kln8=_3m^%&og1Cq^RrH#tzmz{IfafeFfcH9y85}Sb4q9e0BP^KrT_o{ diff --git a/doc/html/images/callouts/9.png b/doc/html/images/callouts/9.png deleted file mode 100644 index abe636072b61306fbcd6157b95dfdf7e86a77e5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 420 zcmeAS@N?(olHy`uVBq!ia0y~yU=UznVBqFpV_;w?d&FzWz`&U8>EaktF{gEcf7T%f znb!OIl8YM`EC?0g)MK6LySsR*bBW@-#a{$sD|jaA?Rq5|BVw*<(2>_Fw2;L_Ls+eT z*=m-pP5G8*zMrjje*N{AqvqEc&v$lO8~PeQnNu$u7&XUG^XcT&$oGAZue{@YWbseb zX;0Q#doE68rNi6aM(w}9J~guKY8ESl1YdhX&(saqqyj~D?!KF+)#9L-_*{J2Y1Ks< zObjyp?mceG5^anO3Q8tYyaIvx98EzeZXaKe_`Z|7b6wRX+{3FhZAn{V<2dEM9+du_kptYsE+ z{WKfa2W_~S^T2{nZ8E1=H*3uG*3`)V4^%t_SRAV?Wb9U5edYbrW%=bs0jAGCWzMDv z&-uLjLxRB%P3bLBx;@8}pH%jFEoHiFvT*CZ6}7y~440#x2c4?eefQp-XqD5OV!VD< d@-ZKf|NC_Jf+y*vd<+Z>44$rjF6*2UngH>Mv>N~b diff --git a/doc/html/images/caution.png b/doc/html/images/caution.png deleted file mode 100755 index 3c3b859c2276a628a5b5c7dc50ac720abec0b612..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmeAS@N?(olHy`uVBq!ia0y~yV31>AV36WqV_;xdu<*?m1_lPk;vjb?X7l5|!3+$X z#hK2|0h!6k3=9>w-p))95XqD}e*fJ(8HpK^Z9L9?LaICpmg*B_Tv*di7#x})VxZWq zy`ibYBZx(iHKw4Hb5mEB2Ahi`BlE6i9i~&ec66;+ai^#5!>V_$?CwrqJ^O$A_WG}1 zg1?qjto{{#mEnY+%Erl;6Py_)?R;rtAI_fUks%>$&9;GobwvZ?6Xlzkn)m+cF**n& z>i?L&N1A!UhYJ7q_viobS1g*eQ-(odPJ^(;#mpSW<=hs1lg|iVQ*W6wb)M3SgMLiQ zKC_5xJP=THuYIhdc)afM-1usyKQgQ_d<=aezo&A#x5|8-x^j8TnZC!W%nG-4UxfcQ z`<{JdYm528p6AQlKku06dF#Rcx%IPDr>WIE2$cNj`LgQco&Ogt5B>erdoQB?F1x_u zPu01bAINTqV{DjGw|=E8Tf-*lhI9AcZ(Z@2p=2tP!rv)#51#%L=FBN>qQJnlfLU?@ zM@XaC1?FQ1WFi=?AMn^T@N+OMOi)f}wwSI3zb&ztZI9;Fzto-3z-thU5vcW{0luZ_^9gKFY<%gy}jQ*f;rak^pH-|$92Xmm?7Xh(H9X}KjJ$Mc| zZ&PmdV7=6^MbY*ILlOT&<x@g@dv416( zCA78SSCiV}rx$l+cyF<`Vv+4W=On&B`-1NazAvF)G^(Wj@--hcFqkD#+#{_fGP&X8 zL6Ky>=UBzt z9zXh2Ai6^=Mn8|mygB+<_v5P{r&Y+?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Toz+(LCcgfPjEu~jdGi)&tO}DlG?61f zZ+dF}*L%$?Zu8zQQ(T-`e_qx@ab<+kG!NC7_pvkDdvlNQojL3_|N8W^X@MeFn~tSu zvBuQxHhFhLMQQ74&b`&*29bNJ^)%*s9-q81#p>n93c2kQB5Z4agc-50<}GzhKbyAM zVQbXc`g6_Fw<;Ij$@`nI{ijW}qe`<%(8my~r=Ndorri2`P*7^B91lyN$XSIB$Mn-r zi|%i4dS;i`H0!41%9~HV{eEz!P;I84k|ayhf^~e)44$hl-W|W#tU>y=*Uqq|H?%~! z?7#ig{GS=TcFIjTcIC6 zg}t5zefbcecUez&&H3|QF5Z`Pn-4xMYkgo))FX0^>uAu&N1ql&t-W{W&L8ec{U2rK Uy!q45z`(%Z>FVdQ&MBb@04`<@YXATM diff --git a/doc/html/images/important.png b/doc/html/images/important.png deleted file mode 100755 index 54b4846b49cb77d09578e03fddef8173e5b2cde6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4666 zcmeAS@N?(olHy`uVBq!ia0y~yV2}f04mJh`25Wk44otVv!`vx;GaF%2` zI|pPYCo?cq+iGS4^JFAuNVf4f%QU%gGJBl!RACQnlr-uwP+|2s@rY}U zg3=@rM;Au%nAoN@i)u_i-MQ;$eZ}u^fBR7X z_U)_cLwOtCR4A!yikdMfbWT6^y>w$bTYHPq#>EWW0S#PB8oXH4O>dq)e^Z`g^Cj+o zs_)$xw-oJJ{`>v;|HlP(dfMnQ2>6}&cxOdO--OF8GN*kXt-EqO+`?ElGNM_w)#o|4 ze!z)?+A=?Tg~KhLNx%Pd>+$>73Qvp}3YN@R?_;s+(8TzeRavc;8~>;RLJ@J^KWEz9Q-zk&No&OQ$yjCZ}fkDK9-N-?3 z1(WXr?w$t84J_LZaPDBvf57i_!0iCzMg`6fj%p_ucRSc=u&6#zSi!V)0i#J{SOHr} z)8_|9JJ|9XcPFseurV31#x+%b;L~vwXlXqmz&ojNibAOeyHV4P38qh2DxLNPaES07 zb+FNp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GVmQrt*8fYmIh^IP!zw=8 z{`}M}qA&l4Reaj~)32QPS*2_1E|fRxlnPq6ZeBYfaMSLuzdLhm_zORGyVl%}nlAtU z$@GfvcgsKAnrWQ(|4)bZH{VC=7n^tPDc4@=`|bPpj~^cH|N8Oze~~ZmA3nNNYzC)wmA!f6#(`(${H8DMr%&2{`r5^9%Y`>S|B&eP&u!kDt;;1p zZ#t*H=G3iQ`~`)%zMd*pQL+cE|H)mgQ+@RR>!oSSR+j9Jee>SDwEFwfoZOFdYOY+0 zTd%FQHR*BY%8*GfZ(8c;o0e?cs8Ia*^NKJnuihW~-~0V%wBwUGdMNm~9|HpegQu&X J%Q~loCIHo{?ri`7 diff --git a/doc/html/images/next.png b/doc/html/images/next.png deleted file mode 100755 index f3a1221df31c3c2ba4e3a72edad38c13703767b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmeAS@N?(olHy`uVBq!ia0y~yU=Rjj4kiW$hQCG&XEQJ`a29w(7Bet#3xP1>rMq>1 z7#Nr~dAc};RLp6eeB1w40K>80^1pI=K031Q+}6PA-o zut+zF-j;Gw?uf*D*{((14$Hcux3in6E_!$R{mVIjisa6HXWSoM6uZ0c{E^r9Ur$om zdhZ^4hON-~BYZ2GeK$N>`J?GiOJzY(!s6V|uRrr03%sLkr*1#v(teTeT^zk4U9DU7 zv%f8b6P+XKjO)LDUiZ<0p*o>#X6mOi#R1wP z8(l6)T21PWa1OIO8vZ)ea}qY-^=ZrWvbZQ6m)_kQvcrVw=bvte)59DYyUFcC9E$Tt4>&6 z+W%-jd;GDDoIH;dN(0uWOyTmnDE=b*gwcE+xwelYeE}Q`Hm&Y3XPNlB+x+oXzleq5 z0w#UgMVr)jUI2-(`lA6OUY& zu=Q|M1xs0v^{>u8Av+EoyuB{di7k}!tvm{Q)|ESyVT{*EHLXF20N@PNRO*vTc;nVG>kH2j-tEeVx#8P4@BjRN>Ropm;oHA%y^x5t(%-w` ajXhtHa_t{xfsG6d3=E#GelF{r5}E)mona0D diff --git a/doc/html/images/note.png b/doc/html/images/note.png deleted file mode 100755 index c3bebc7ea6aae0fd9b713ef8ab3cefc31751a03a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4648 zcmeAS@N?(olHy`uVBq!ia0y~yV2}f04mJh`25Wk44otVv!`vx;GaF%2` zI|pPYCo?cq+iGS4^JFAuNVf4f%QU%gGJBl!RACQnlr-uwP+|2s@rY}U zg3=@rM;Au%nAoN@i)u_i-MQ;$eZ}u^fBR7X z_U)_cLwOtCR4A!yikdMfbWT6^y>w$bTYHPq#>EWW0S#PB8oXH4O>dq)e^Z`g^Cj+o zs_)$xw-oJJ{`>v;|HlP(dfMnQ2>6}&cxOdO--OF8GN*kXt-EqO+`?ElGNM_w)#o|4 ze!z)?+A=?Tg~KhLNx%Pd>+$>73Qvp}3YN@R?_;s+(8TzeRavc;8~>;RLJ@J^KWEz9Q-zk&No&OQ$yjCZ}fkDK9-N-?3 z1(WXr?w$t84J_LZaPDBvf57i_!0iCzMg`6fj%p_ucRSc=u&6#zSi!V)0i#J{SOHr} z)8_|9JJ|9XcPFseurV31#x+%b;L~vwXlXqmz&ojNibAOeyHV4P38qh2DxLNPaES07 zb+FNpJ=Iv|+!~-6!g|%w_k#Wf%NIr^%u-EqPQn*-zL1s<_R1!E%BRqtmtJ%vj*IjhsssQys*%fwIY_G6n z$$e$@bvwPd^nzH1d5M7)+uY7`?$Z}bUwr#w^$Wo-BEMwWniCTuB#e8s)mVi4PaYFV z6eM50-!MX5nP&PH_F8enhxTP>W-2 z%j%ZGL()nUS2&rd{}OoIVcjWurp`3r$_(TcprB@sj6n4|R{}9{is9CsH=C z-JB-l<){2!*?i*q3G*l2@4k5C%aJ=rb|hIJS#{LvNZZl4zz-s&U9zdls@*|;mfky^ zX9^$h&hD`8aPP<$UoU2_Zl|_S!Ev&|ln>K9CTUE{n6^XF(D`VP=?cFPJ=6ZGo~l+W zPv?wPChSt}+h$*L*zGlYQSu9&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pJZbaq0#d>pAX|4<8H@}^=@Y#ys;J!tPM|nS0 z&$%x=X?=;t(L%4j2C4UPtr~vdzmI` zZxwy~V7IW%t(T9kEwwyz!TN2jh2Y5vD?c7B<3E2hGiUO4_cdgW_$DJ#uX1QdCgu~xuY_Zk$?NHAHRQb-P+wQjz-zVqxwMV(Z)I0;nQV*ts!Xxc`-k4Yf0xvF-hTHbm(7k3cUAhY zR5lY=oM60s*;8@zuqCU4e*U;uymG_(pHKP2Q`SE85;}gU<4nS>lY7th)%;s>)=R|e z$SKj*jRJx*SKs<{@$0fR8)bi9{u}#p8~dk=TPt^daEr})qqSzDE7#NYUp}c@EoTl} zyH~vS>&d^ef1aH)a}wLjzfM0nci}2IyVno?rLniGmnej9(3+*OLuc`4Q|a)q*RPK4 zWV6~UF#k_={I9!;dGYaK_VxLq+1jSpGIDQRY3>XDawsihop@Sp>E}<2>{345K411> zx3z!a&$Dg2N(<%8&t2Jgy?4WD=OwlszVD;8tt0ZL6z+Pbn8dl~_gBStwsyyOy1%Zk z+tBp=eq7jcvDF&C^?3Vs+x=bpYlg7!#+P$fM8w|u7WeJr)5+8RJUwXlZqv(4PfJ>5 z_HK-sd~~MKDb>Be ztk+A*m43F0Rtj4eWuwvhgDFjR{X{Aex82ms+k$zbJcbn|CXM(P3H;g*_}pu`y!7&{3yWw)}hZ& zX<0zhixnGwoVgYgIp^z5&tGp2)|xD{4dLi~{p@S4$-jJO`1tMO_}k&NpNnc#Nc uqerwuqg^+zYt_2{^P6@3mfoXZ;{*5dChuIwP|v`?z~JfX=d#Wzp$P!oJ@O|2 diff --git a/doc/html/images/prev.png b/doc/html/images/prev.png deleted file mode 100755 index f7f036150f816cbbd5abb1adc8b0b3a23cb18884..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 741 zcmeAS@N?(olHy`uVBq!ia0y~yU=Rjj4kiW$hQCG&XEQJ`a29w(7Bet#3xP1>rMq>1 z7#NtQd%8G=RLtp}eB1w4fK0=0`CmC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_&)VBTXOQGMHO0&FQ0fc*<8Q)Y~G{k)!_w?kCk?|rv1=6=G*)Dr;>l=;c}b?KB1mm`l{Oo-0<@#t3Vny_mRDop)6m(G&W zeUPAc{`$IqUPqmm7k>QfJ;%uSkfqcb!G!p8s^{;2G!|T0#(HYTVT;fj?-pxSyA><; zJ$P`(viH)h*od=SLC>B%SSYq{)AOHi4N7HOtcg;K>V49^U>kskX)! zB5jwS?>&DpUGBHDqCoSV3}xl5M>(Vy#+3y94Y=!gZNX99e|7~9(to=jebyHLx-Q1{ zS?qhI!z;@;rS>pSbZ!hS;GEqTyEbe6&vo}5=WLl`9yBEto(`(>tF_CQWW{D{`JPaYN|_K{dUgtfF0uEzhM}t6EQH psb#a8d#Lo`e!guT|C9f)E5E#+x?G@Khk=2C!PC{xWt~$(696HeggpQN diff --git a/doc/html/images/up.png b/doc/html/images/up.png deleted file mode 100755 index ef434074cab1625251ba558c14e5bf47c5add70b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmeAS@N?(olHy`uVBq!ia0y~yU=Rjj4kiW$hQCG&XEQJ`a29w(7Bet#3xP1>rMq>1 z7#Nr~c)B=-RLp6;bl3k@f(YA(e{|{j<+dCaBWI8i{UJGmx+J6bk>#`QET?BKe36&H*(nnSBa;ApSy0(ER7Nl zYjK~DdPMD3MyK4#Cy_?w)4JauzrJMaoGHfVq|e*WcV=C=Vc&MWXGed2*wbhhAslAX z7UinF)0wTSaiWO7tC8C-rFCD@tmMPc4`y z%U|lDdFu7GtxYm~?Q8wGlMTW1?_|wC`1<}Q_HE2> z^iIDmzSz7XK*VES&i%h3)A;-OuW+R<)KS~csg`gxduo+mZiGRCh}r2gmkfVB{P?~2 br+99$L2LK4shb%X7#KWV{an^LB{Ts5mN;Xz diff --git a/doc/html/images/warning.png b/doc/html/images/warning.png deleted file mode 100755 index 51a30f751179811a3367891c0e54b1dea7afd3ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 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Y&rz3~7 zdGfgB86VtL>SbQJ*d&f+4u8X+P_HE!(N>pIZM|D>O%}R(?%8Kg)9@Y6-xc>>7cmlF z@T%Uh&|KncWk;>kR?aPJ?H-3N3N73#npwqg;=+W9tp(TKKT*G58fGQo_FS`XK~}x; zy7P{f?#2TgP@zQBToLwwn9SmAkvz_MiQ(q+;G>apO{vS8Kalt;UWo z_u527^Y6EME}kS5vP#v*=gjJzJB|G2y*V~jo4H`qUxUxnx6YX;-L{1Lzif=IgQ;Ln zk8&5U#Jk8(r)JF7e)RCL>6&$6hL$^fT7N2Sou06(xkHKh;WOL4?@|NhCuOy+*vB!y zjrY6K;@k9nn8~W2h+KQE`cs}PSI0d3o5^TReJK5i@){XV~v_=ku0~3Ikx?4 zh~2?+c-2Pj)+G{t=PofU3S4H^@;GAG8kbj7qTP2H^enJBy45(!fAQI z>HnUI9QtLn>z_YPj zt9G}{px4$SF`iL}ezEOomG&r~-#6`Y&AC)6Ms%Xs?o-wbg!Kt6${PGj? zAc>2OEm|8cxh}bzSMk|Cv$jy?z4y=V2SF3BnAeGmhN?tc9NT0f1C?=i za$@h<&7U4~ZOX-maxc$CPEp)3Z{m@K245$=-1;+aQq)KDcL6)j_kB&;@_L1C@4=Vy zO`Z-5cOJ;_T(#};XC2YxCo$%3ZPkUDOZc~WatNgSc0cfSbwS^kgV8$=UWs=)C3)lJ ztYgIqF9l7ne0wybY2lQ&H@uoMRnJORJ>Ixrv8)ltnum_zwZA@cmVT`1HwxYJzS?P0 zz?+qN+fP=l(#n5n_VxFzGy4ySE)JaMTKX}4hdYB^XH z)80}%XMe9sQeyclx9=;nBj)|%+q7X}Z&{V^+aHT&NKCikQocSRN#4J2t-NRW;|+sTQSQJ0kN;+$zDxJQ84oit1_lNO MPgg&ebxsLQ0L+(v)Bpeg diff --git a/doc/html/index.html b/doc/html/index.html index 298875d..24277e1 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -8,16 +8,16 @@ - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+ + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore


-
Next
+
Next

@@ -27,7 +27,7 @@

- - + +

Last revised: May 29, 2007 at 06:31:03 GMT

Last revised: February 12, 2008 at 22:47:14 GMT


-
Next
+
Next
diff --git a/doc/optional.html b/doc/optional.html deleted file mode 100644 index b9ef36b..0000000 --- a/doc/optional.html +++ /dev/null @@ -1,1803 +0,0 @@ - - - - - - - - - - -Header - - - -

Header <boost/optional/optional.hpp>

- -

Contents

-
-
Motivation
-
Development
-
Synopsis
-
Semantics
-
Examples
-
Optional references
-
Rebinding semantics for assignment of optional references
-
none_t and none
-
In-Place Factories
-
A note about optional<bool>
-
Exception Safety Guarantees
-
Type requirements
-
Implementation Notes
-
Dependencies and Portability
-
Acknowledgment
-
- -
- -

Motivation

- -

Consider these functions which should return a value but which might not have - a value to return:

-
(A) double sqrt(double n );
-(B) char get_async_input();
-(C) point polygon::get_any_point_effectively_inside();
-

There are different approaches to the issue of not having a value to return.

-

A typical approach is to consider the existence of a valid return value as - a postcondition, so that if the function cannot compute the value to return, - it has either undefined behavior (and can use assert in a debug build) - or uses a runtime check and throws an exception if the postcondition is violated. - This is a reasonable choice for example, for function (A), because the - lack of a proper return value is directly related to an invalid parameter (out - of domain argument), so it is appropriate to require the callee to supply only - parameters in a valid domain for execution to continue normally.

-

However, function (B), because of its asynchronous nature, does not fail just - because it can't find a value to return; so it is incorrect to consider - such a situation an error and assert or throw an exception. This function must - return, and somehow, must tell the callee that it is not returning a meaningful - value.

-

A similar situation occurs with function (C): it is conceptually an error to - ask a null-area polygon to return a point inside itself, but in many - applications, it is just impractical for performance reasons to treat this as - an error (because detecting that the polygon has no area might be too expensive - to be required to be tested previously), and either an arbitrary point (typically - at infinity) is returned, or some efficient way to tell the callee that there - is no such point is used.

-

There are various mechanisms to let functions communicate that the returned - value is not valid. One such mechanism, which is quite common since it has zero - or negligible overhead, is to use a special value which is reserved to communicate - this. Classical examples of such special values are EOF, string::npos, points - at infinity, etc...

-

When those values exist, i.e. the return type can hold all meaningful values - plus the signal value, this mechanism is quite appropriate and - well known. Unfortunately, there are cases when such values do not exist. In - these cases, the usual alternative is either to use a wider type, such as 'int' - in place of 'char'; or a compound type, such as std::pair<point,bool>. -

-

Returning a std::pair<T,bool>, thus attaching a boolean flag to the result - which indicates if the result is meaningful, has the advantage that can be turned - into a consistent idiom since the first element of the pair can be whatever - the function would conceptually return. For example, the last two functions - could have the following interface:

-
std::pair<char,bool> get_async_input();
-std::pair<point,bool> polygon::get_any_point_effectively_inside();
-

These functions use a consistent interface for dealing with possibly inexistent - results:

-
std::pair<point,bool> p = poly.get_any_point_effectively_inside();
-if ( p.second )
-  flood_fill(p.first);
-
- -

However, not only is this quite a burden syntactically, it is also error - prone since the user can easily use the function result (first element of the - pair) without ever checking if it has a valid value.

-

Clearly, we need a better idiom.

- -

Development

- -

The models:

-

In C++, we can declare an object (a variable) of type T, and we can give this variable - an initial value (through an initializer. (c.f. 8.5)).
- When a declaration includes a non-empty initializer (an initial value is given), it is said that - the object has been initialized.
- If the declaration uses an empty initializer (no initial value is given), - and neither default nor value initialization applies, it is said that the object is - uninitialized. Its actual value exist but has an - indeterminate initial value (c.f. 8.5.9).
- optional<T> intends to formalize the notion of initialization -(or lack of it) - allowing a program to test whether an object has been initialized and stating that access to - the value of an uninitialized object is undefined behavior. That is, - when a variable is declared as optional<T> and no initial value is given, - the variable is formally uninitialized. A formally uninitialized optional object has conceptually - no value at all and this situation can be tested at runtime. It is formally -undefined behavior - to try to access the value of an uninitialized optional. An uninitialized optional can be assigned a value, in which case its initialization state changes to initialized. Furthermore, given the formal - treatment of initialization states in optional objects, it is even possible to reset an optional to uninitialized.

-

In C++ there is no formal notion of uninitialized objects, which - means that objects always have an initial value even if indeterminate.
- As discussed on the previous section, this has a drawback because you need additional - information to tell if an object has been effectively initialized.
- One of the typical ways in which this has been historically - dealt with is via a special value: EOF,npos,-1, etc... This is equivalent to adding - the special value to the set of possible values of a given type. This super set of - T plus some nil_t—were nil_t is some stateless POD-can be modeled in modern - languages as a discriminated union of T and nil_t. - Discriminated unions are often called variants. A variant has a current type, - which in our case is either T or nil_t.
- Using the Boost.Variant library, this model can be implemented - in terms of boost::variant<T,nil_t>.
- There is precedent for a discriminated union as a model for an optional value: the - Haskell Maybe built-in type constructor. -Thus, a discriminated union T+nil_t serves as a conceptual foundation.

-

A variant<T,nil_t> follows naturally from the traditional idiom of extending -the range of possible values adding an additional sentinel value with the special meaning of Nothing. -However, this additional Nothing value is largely irrelevant for our purpose - since our goal is to formalize the notion of uninitialized objects and, while a special extended value can be used to convey that meaning, it is not strictly -necessary in order to do so.

-

The observation made in the last paragraph about the irrelevant nature of the additional nil_t with respect to -purpose of optional<T> suggests -an alternative model: a container that either has a value of T or nothing. -

-

As of this writing I don't know of any precedent for a variable-size fixed-capacity (of 1) -stack-based container model for optional values, yet I believe this is the consequence of -the lack of practical implementations of such a container rather than an inherent shortcoming -of the container model.

-

In any event, both the discriminated-union or the single-element container models serve as a conceptual -ground for a class representing optional—i.e. possibly uninitialized—objects.
-For instance, these models show the exact semantics required for a wrapper of optional values:

-

Discriminated-union:

-
-
  • deep-copy semantics: copies of the variant implies copies of the value.
  • -
  • deep-relational semantics: comparisons between variants matches both current types and values
  • -
  • If the variant's current type is T, it is modeling an initialized optional.
  • -
  • If the variant's current type is not T, it is modeling an uninitialized optional.
  • -
  • Testing if the variant's current type is T models testing if the optional is initialized
  • -
  • Trying to extract a T from a variant when its current type is not T, models the undefined -behavior -of trying to access the value of an uninitialized optional
  • -
    -

    Single-element container:

    -
    -
  • deep-copy semantics: copies of the container implies copies of the value.
  • -
  • deep-relational semantics: comparisons between containers compare container size and if match, contained value
  • -
  • If the container is not empty (contains an object of type T), it is modeling an initialized optional.
  • -
  • If the container is empty, it is modeling an uninitialized optional.
  • -
  • Testing if the container is empty models testing if the optional is initialized
  • -
  • Trying to extract a T from an empty container models the undefined behavior -of trying to access the value of an uninitialized optional
  • -
    - -

    The semantics:

    -

    Objects of type optional<T> are intended to be used in places where objects of type T would -but which might be uninitialized. Hence, optional<T>'s purpose is to formalize the -additional possibly uninitialized state.
    -From the perspective of this role, optional<T> can have the same operational semantics of T -plus the additional semantics corresponding to this special state.
    -As such, optional<T> could be thought of as a supertype of T. Of course, -we can't do that in C++, so we need to compose the desired semantics using a different mechanism.
    -Doing it the other way around, that is, making optional<T> a subtype of T is not only -conceptually wrong but also impractical: it is not allowed to derive from a non-class type, such as a -built-in type.

    - -

    We can draw from the purpose of optional<T> the required basic semantics:

    - -
    -

    Default Construction: To introduce a formally uninitialized wrapped -object.

    - -

    Direct Value Construction via copy: To introduce a formally -initialized wrapped object whose value is obtained as a copy of some object.

    - -

    Deep Copy Construction: To obtain a new yet equivalent wrapped -object.

    - -

    Direct Value Assignment (upon initialized): To assign a value to the wrapped object.

    - -

    Direct Value Assignment (upon uninitialized): To initialize the wrapped object -with a value obtained -as a copy of some object.

    - -

    Assignment (upon initialized): To assign to the wrapped object the value -of another wrapped object.

    - -

    Assignment (upon uninitialized): To initialize the wrapped object -with value of another wrapped object.

    - -

    Deep Relational Operations (when supported by the type T): To compare -wrapped object values taking into account the presence of uninitialized -states.

    - -

    Value access: To unwrap the wrapped object.

    - -

    Initialization state query: To determine if the object is formally -initialized or not.

    - -

    Swap: To exchange wrapped objects. (with whatever exception safety -guarantees are provided by T's swap).

    - -

    De-initialization: To release the wrapped object (if any) and leave -the wrapper in the uninitialized state.

    - -
    - -

    Additional operations are useful, such as converting constructors and -converting assignments, in-place construction and assignment, and safe value -access via a pointer to the wrapped object or null.

    -

    The Interface:

    -

    Since the purpose of optional is to allow us to use objects with a formal -uninitialized additional state, the interface could try to follow the interface -of the underlying T type as much as possible. In order to choose the proper -degree of adoption of the native T interface, the following must be noted:
    -Even if all the operations supported by an instance of type T are defined for -the entire range of values for such a type, an optional<T> extends such a set of -values with a new value for which most (otherwise valid) operations are not -defined in terms of T.
    -Furthermore, since optional<T> itself is merely a T wrapper (modeling a T -supertype), any attempt to define such operations upon uninitialized optionals -will be totally artificial w.r.t. T.
    -This library chooses an interface which follows from T's interface only for -those operations which are well defined (w.r.t the type T) even if any of the -operands are uninitialized. These operations include: construction, -copy-construction, assignment, swap and relational operations.
    -For the value access operations, which are undefined (w.r.t the type T) when the -operand is uninitialized, a different interface is chosen (which will be -explained next).
    -Also, the presence of the possibly uninitialized state requires additional -operations not provided by T itself which are supported by a special interface.

    -

    Lexically-hinted Value Access in the presence of possibly untitialized -optional objects: The operators * and ->

    -

    A relevant feature of a pointer is that it can have a null - pointer value. This is a special value which is used to indicate that the - pointer is not referring to any object at all. In other words, null pointer - values convey the notion of inexistent objects.

    -

    This meaning of the null pointer value allowed pointers to became a de facto standard - for handling optional objects because all you have to do to refer to a value which you - don't really have is to use a null pointer value of the appropriate type. - Pointers have been used for decades—from the days of C APIs to modern C++ libraries—to - refer to optional (that is, possibly inexistent) objects; particularly - as optional arguments to a function, but also quite often as optional data members.

    -

    The possible presence of a null pointer value makes the operations that access the - pointee's value possibly undefined, therefore, expressions which use dereference - and access operators, such as: ( *p = 2 ) and ( p->foo()), - implicitly convey the notion of optionality, and this information is tied to - the syntax of the expressions. That is, the presence of operators * and -> tell by - themselves—without any additional context—that the expression will be undefined unless - the implied pointee actually exist.

    -

    Such a de facto idiom for referring to optional objects can be formalized in the form of a -concept: the OptionalPointee concept.
    -This concept captures the syntactic usage of operators *, -> and conversion to bool to convey -the notion of optionality.

    -

    However, pointers are good to refer to optional objects, but not particularly good -to handle the optional objects in all other respects, such as initializing or moving/copying -them. The problem resides in the shallow-copy of pointer semantics: if you need to - effectively move or copy the object, pointers alone are not enough. The problem - is that copies of pointers do not imply copies of pointees. For example, as - was discussed in the motivation, pointers alone cannot be used to return optional - objects from a function because the object must move outside from the function and - into the caller's context.
    - A solution to the shallow-copy problem that is often used is to resort to dynamic - allocation and use a smart pointer to automatically handle the details of this. - For example, if a function is to optionally return an object X, it can use shared_ptr<X> - as the return value. However, this requires dynamic allocation of X. If X is - a built-in or small POD, this technique is very poor in terms of required resources. - Optional objects are essentially values so it is very convenient to be able to use automatic - storage and deep-copy semantics to manipulate optional values just as we do with ordinary - values. Pointers do not have this semantics, so are inappropriate for the initialization and - transport of optional values, yet are quite convenient for handling the access to the - possible undefined value because of the idiomatic aid present in the OptionalPointee - concept incarnated by pointers. -

    -

    Optional<T> as a model of OptionalPointee

    -

    For value access operations optional<> uses operators * and -> to lexically -warn about the possibly uninitialized state appealing to the familiar pointer -semantics w.r.t. to null pointers.
    -However, it is particularly important to note that optional<> objects are not pointers. optional<> -is not, and does not model, a pointer. -

    For instance, optional<> does not have shallow-copy so does not alias: two different optionals - never refer to the same value unless T itself is a reference (but may have equivalent values).
    - The difference between an optional<T> and a pointer must be kept in mind, particularly - because the semantics of relational operators are different: since optional<T> - is a value-wrapper, relational operators are deep: they compare optional values; - but relational operators for pointers are shallow: they do not compare pointee values.
    - As a result, you might be able to replace optional<T> by T* on some situations but - not always. Specifically, on generic code written for both, you cannot use relational - operators directly, and must use the template functions - equal_pointees() and - less_pointees() instead. -


    - -

    Synopsis

    - -
    namespace boost {
    -
    -template<class T>
    -class optional
    -{
    -  public :
    -
    -    (If T is of reference type, the parameters and results by reference are by value)
    -
    -    optional () ;
    -
    -    optional ( none_t ) ;
    -
    -    optional ( T const& v ) ;
    -
    -    optional ( bool condition, T const& v ) ;  [new in 1.34]
    -    
    -    optional ( optional const& rhs ) ;
    -
    -    template<class U> explicit optional ( optional<U> const& rhs ) ;
    -
    -    template<InPlaceFactory> explicit optional ( InPlaceFactory const& f ) ;
    -
    -    template<TypedInPlaceFactory> explicit optional ( TypedInPlaceFactory const& f ) ;
    -
    -    optional& operator = ( none_t ) ;
    -
    -    optional& operator = ( T const& v ) ;
    -
    -    optional& operator = ( optional const& rhs ) ;
    -
    -    template<class U> optional& operator = ( optional<U> const& rhs ) ;
    -
    -    template<InPlaceFactory> optional& operator = ( InPlaceFactory const& f ) ;
    -
    -    template<TypedInPlaceFactory> optional& operator = ( TypedInPlaceFactory const& f ) ;
    -
    -    T const& get() const ;
    -    T&       get() ;
    -
    -    T const& get_value_or( T const& default ) const ;  [new in 1.34]
    -    
    -    T const* operator ->() const ;
    -    T*       operator ->() ;
    -
    -    T const& operator *() const ;
    -    T&       operator *() ;
    -
    -    T const* get_ptr() const ;
    -    T*       get_ptr() ;
    -
    -    operator unspecified-bool-type() const ;
    -
    -    bool operator!() const ;
    -
    -    deprecated methods
    -
    -    void reset() ; (deprecated)
    -    void reset ( T const& ) ; (deprecated)
    -    bool is_initialized() const ; (deprecated)
    -
    -} ;
    -
    -template<class T> inline bool operator == ( optional<T> const& x, optional<T> const& y ) ;
    -
    -template<class T> inline bool operator != ( optional<T> const& x, optional<T> const& y ) ;
    -
    -template<class T> inline bool operator <  ( optional<T> const& x, optional<T> const& y ) ;
    -
    -template<class T> inline bool operator >  ( optional<T> const& x, optional<T> const& y ) ;
    -
    -template<class T> inline bool operator <= ( optional<T> const& x, optional<T> const& y ) ;
    -
    -template<class T> inline bool operator >= ( optional<T> const& x, optional<T> const& y ) ;
    -
    -template<class T> inline bool operator == ( optional<T> const& x, T const& n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator != ( optional<T> const& x, T const& n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <  ( optional<T> const& x, T const& n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >  ( optional<T> const& x, T const& n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <= ( optional<T> const& x, T const& n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >= ( optional<T> const& x, T const& n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator == ( T const& n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator != ( T const& n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <  ( T const& n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >  ( T const& n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <= ( T const& n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >= ( T const& n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator == ( optional<T> const& x, none_t n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator != ( optional<T> const& x, none_t n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <  ( optional<T> const& x, none_t n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >  ( optional<T> const& x, none_t n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <= ( optional<T> const& x, none_t n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >= ( optional<T> const& x, none_t n ) ; [new in 1.34]
    -
    -template<class T> inline bool operator == ( none_t n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator != ( none_t n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <  ( none_t n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >  ( none_t n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator <= ( none_t n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline bool operator >= ( none_t n, optional<T> const& y ) ; [new in 1.34]
    -
    -template<class T> inline optional<T> make_optional ( T const& v ) ;  [new in 1.34]
    -
    -template<class T> inline optional<T> make_optional ( bool condition, T const& v ) ;  [new in 1.34]
    -
    -template<class T> inline T const& get_optional_value_or ( optional<T> const& opt, T const& default ) ;  [new in 1.34]
    -
    -template<class T> inline T const& get ( optional<T> const& opt ) ;
    -
    -template<class T> inline T& get ( optional<T> & opt ) ;
    -
    -template<class T> inline T const* get ( optional<T> const* opt ) ;
    -
    -template<class T> inline T* get ( optional<T>* opt ) ;
    -
    -template<class T> inline T const* get_pointer ( optional<T> const& opt ) ;
    -
    -template<class T> inline T* get_pointer ( optional<T> & opt ) ;
    -
    -template<class T> inline void swap( optional<T>& x, optional<T>& y ) ;
    -
    -} // namespace boost
    -
    - -
    - -

    Detailed Semantics

    - -

    NOTES:

    - -

    Because T might be of reference type, in the sequel, those entries whose -semantic depends on T being of reference type or not will be distinguished using -the following convention:
    -If the entry reads: optional<T (not a ref)>, the description corresponds only to -the case where T is not of reference type.
    -If the entry reads: optional<T&>, the description corresponds only to the case -where T is of reference type.
    -If the entry reads: optional<T>, the description is the same for both cases.

    - -

    The following section contains various assert() which are used only to -show the postconditions as sample code. It is not implied that the type T must -support each particular expression but that if the expression is supported, the -implied condition holds.

    - -
    - -
    optional<T>::optional();
    -
    -

    Effect: Default-Constructs an optional.

    -

    Postconditions: *this is uninitialized.

    -

    Throws: Nothing.

    -

    Notes: T's default constructor is not called.

    -

    Example:

    -
    -
    optional<T> def ;
    -assert ( !def ) ;
    -
    -
    - -
    - -
    optional<T>::optional( none_t );
    -
    -

    Effect: Constructs an optional uninitialized.

    -

    Postconditions: *this is uninitialized.

    -

    Throws: Nothing.

    -

    Notes:

    -
    -

    T's default constructor is not called.
    -The -expression boost::none denotes an instance of boost::none_t that can be -used as the parameter.

    -
    -

    Example:

    -
    -
    -#include <boost/none.hpp>
    -optional<int> n(boost::none) ;
    -assert ( !n ) ;
    -
    -
    -
    - -
    - -
    optional<T (not a ref)>::optional( T const& v )
    -
    -

    Effect: Directly-Constructs an optional.

    -

    Postconditions: *this is initialized and its value is a copy of 'v'.

    -

    Throws: Whatever T::T( T const& ) throws.

    -

    Notes: T::T( T const& ) is called.

    -

    Exception Safety: Exceptions can only be thrown during T::T( T const& ); -in that case, this constructor has no effect. -

    -

    Example:

    -
    -
    -T v;
    -optional<T> opt(v);
    -assert ( *opt == v ) ;
    -
    -
    -
    - -
    - -
    optional<T&>::optional( T& ref )
    -
    -

    Effect: Directly-Constructs an optional.

    -

    Postconditions: *this is initialized and its value is an -instance of an internal type wrapping the reference 'ref'.

    -

    Throws: Nothing.

    -

    Example:

    -
    -
    -T v;
    -T& vref = v ;
    -optional<T&> opt(vref);
    -assert ( *opt == v ) ;
    -++ v ; // mutate referee
    -assert (*opt == v); 
    -
    -
    -
    - -
    - -
    optional<T (not a ref)>::optional( bool condition, T const& v ) ;
    -optional<T&>           ::optional( bool condition, T&       v ) ;
    -
    - -
    -

    If condition is true, same as:

    -
    optional<T (not a ref)>::optional( T const& v )
    -optional<T&>           ::optional( T&       v )
    -
    -

    otherwise, same as:

    -
    -optional<T (not a ref)>::optional()
    -optional<T&>           ::optional()
    -
    -
    - -
    - -
    optional<T (not a ref)>::optional( optional const& rhs );
    -
    -

    Effect: Copy-Constructs an optional.

    -

    Postconditions: If rhs is initialized, *this is initialized -and its value is a copy of the value of rhs; else *this -is uninitialized.

    -

    Throws: Whatever T::T( T const& ) throws.

    -

    Notes: If rhs is initialized, T::T(T const& ) is called.

    -

    Exception Safety: Exceptions can only be thrown during T::T( T const& ); -in that case, this constructor has no effect. -

    -

    Example:

    -
    -
    -optional<T> uninit ;
    -assert (!uninit);
    -
    -optional<T> uinit2 ( uninit ) ;
    -assert ( uninit2 == uninit );
    -
    -optional<T> init( T(2) );
    -assert ( *init == T(2) ) ;
    -
    -optional<T> init2 ( init ) ;
    -assert ( init2 == init ) ;
    -
    - -
    -
    - -
    - -
    optional<T&>::optional( optional const& rhs );
    -
    -

    Effect: Copy-Constructs an optional.

    -

    Postconditions: If rhs is initialized, *this is initialized -and its value is another reference to the same object referenced by *rhs; else *this -is uninitialized.

    -

    Throws: Nothing.

    -

    Notes: If rhs is initialized, both *this and *rhs will -reefer to the same object (they alias).

    -

    Example:

    -
    -
    -optional<T&> uninit ;
    -assert (!uninit);
    -
    -optional<T&> uinit2 ( uninit ) ;
    -assert ( uninit2 == uninit );
    -
    -T v = 2 ; T& ref = v ;
    -optional<T> init(ref);
    -assert ( *init == v ) ;
    -
    -optional<T> init2 ( init ) ;
    -assert ( *init2 == v ) ;
    -
    -v = 3 ;
    -
    -assert ( *init  == 3 ) ;
    -assert ( *init2 == 3 ) ;
    -
    -
    -
    - -
    -
    - -
    - -
    template<U> explicit optional<T (not a ref)>::optional( optional<U> const& rhs );
    -
    -

    Effect: Copy-Constructs an optional.

    -

    Postconditions: If rhs is initialized, *this is initialized - and its value is a copy of the value of rhs converted - to type T; else *this is uninitialized. -

    -

    Throws: Whatever T::T( U const& ) throws.

    -

    Notes: T::T( U const& ) is called if rhs is initialized, which requires -a valid conversion from U to T. -

    -

    Exception Safety: Exceptions can only be thrown during T::T( U const& ); -in that case, this constructor has no effect. -

    -

    Example:

    -
    - -
    -optional<double> x(123.4);
    -assert ( *x == 123.4 ) ;
    -
    -optional<int> y(x) ;
    -assert( *y == 123 ) ;
    -
    -
    -
    - -
    - -
    template<InPlaceFactory> explicit optional<T (not a ref)>::optional( InPlaceFactory const& f );
    - -
    template<TypedInPlaceFactory> explicit optional<T (not a ref)>::optional( TypedInPlaceFactory const& f );
    -
    -

    Effect: Constructs an optional with a value of T obtained from -the factory.

    -

    Postconditions:  *this is initialized and its value is -directly given from the factory 'f' (i.e., the value is not copied).

    -

    Throws: Whatever the T constructor called by the factory throws.

    -

    Notes: See In-Place Factories

    -

    Exception Safety: Exceptions can only be thrown during the call to the -T constructor used by the factory; -in that case, this constructor has no effect. -

    -

    Example:

    -
    - -
    -class C { C ( char, double, std::string ) ; } ;
    -
    -C v('A',123.4,"hello");
    -
    -optional<C> x( in_place   ('A', 123.4, "hello") ); // InPlaceFactory used
    -optional<C> y( in_place<C>('A', 123.4, "hello") ); // TypedInPlaceFactory used
    -
    -assert ( *x == v ) ;
    -assert ( *y == v ) ;
    -
    -
    -
    -
    - -
    - -
    optional& optional<T>::operator= ( none_t n ) ;
    -
    -

    Effect: Same as opeator=(optional const& rhs), when rhs is default-constructed (uninitialized).

    -

    Postconditions: *this is uninitialized

    -

    Example:

    -
    -
    -#include <boost/none.hpp>
    -
    -optional<int> def ;
    -optional<int> opt(123) ;
    -
    -opt = boost::none ;
    -
    -assert ( opt == def ) ;
    -
    -
    -
    - -
    - -
    optional& optional<T (not a ref)>::operator= ( T const& rhs ) ;
    -
    -

    Effect: Assigns the value 'rhs' to an optional.

    -

    Postconditions: *this is initialized -and its value is a copy of rhs.

    -

    Throws: Whatever T::operator=( T const& ) or T::T(T const&) throws.

    -

    Notes: If *this was initialized, T's assignment operator is -used, otherwise, its copy-constructor is used.

    -

    Exception Safety: In the event of an exception, the initialization -state of *this is unchanged and its value unspecified as far as optional -is concerned (it is up to T's operator=()) [If *this is initially -uninitialized and T's copy constructor fails, *this is left -properly uninitialized]

    -

    Example:

    -
    -
    -T x;
    -optional<T> def ;
    -optional<T> opt(x) ;
    -
    -T y;
    -def = y ;
    -assert ( *def == y ) ;
    -opt = y ;
    -assert ( *opt == y ) ;
    -
    -
    - -
    - -
    optional<T&>& optional<T&>::operator= ( T& const& rhs ) ;
    -
    -

    Effect: (Re)binds thee wrapped reference.

    -

    Postconditions: *this is initialized -and it references the same object referenced by rhs.

    -

    Notes: If *this was initialized, is is rebound to the -new object. See here for details on this behavior.

    -

    Example:

    -
    -
    -int a = 1 ;
    -int b = 2 ;
    -T& ra = a ;
    -T& rb = b ;
    -optional<int&> def ;
    -optional<int&> opt(ra) ;
    -
    -def = rb ; // binds 'def' to 'b' through 'rb'
    -assert ( *def == b ) ;
    -*def = a ; // changes the value of 'b' to a copy of the value of 'a'
    -assert ( b == a ) ;
    -int c = 3;
    -int& rc = c ;
    -opt = rc ; // REBINDS to 'c' through 'rc'
    -c = 4 ;
    -assert ( *opt == 4 ) ;
    -
    -
    -
    - -
    - -
    optional& optional<T (not a ref)>::operator= ( optional const& rhs ) ;
    -
    -

    Effect: Assigns another optional to an optional.

    -

    Postconditions: If rhs is initialized, *this is initialized -and its value is a copy of the value of rhs; else *this -is uninitialized. -

    -

    Throws: Whatever T::operator( T const&) or  T::T( T const& ) throws.

    -

    Notes: If both *this and rhs are initially initialized, -T's assignment operator is used. If *this is initially initialized but -rhs is uninitialized, T's destructor is called. If *this is initially -uninitialized but rhs is initialized, T's copy constructor is called. -

    -

    Exception Safety: In the event of an exception, the initialization -state of *this is unchanged and its value unspecified as far as optional -is concerned (it is up to T's operator=()) [If *this is initially -uninitialized and T's copy constructor fails, *this is left -properly uninitialized]

    -

    Example:

    -
    -
    T v;
    -optional<T> opt(v);
    -optional<T> def ;
    -
    -opt = def ;
    -assert ( !def ) ;
    -// previous value (copy of 'v') destroyed from within 'opt'.
    -
    -
    -
    -
    - -
    - -
    optional<T&> & optional<T&>::operator= ( optional<T&> const& rhs ) ;
    -
    -

    Effect: (Re)binds thee wrapped reference.

    -

    Postconditions: If *rhs is initialized, *this is initialized -and it references the same object referenced by *rhs; otherwise, *this -is uninitialized (and references no object).

    -

    Notes: If *this was initialized and so is *rhs, this -is is rebound to the new object. See here for details on this -behavior.

    -

    Example:

    -
    -
    int a = 1 ;
    -int b = 2 ;
    -T& ra = a ;
    -T& rb = b ;
    -optional<int&> def ;
    -optional<int&> ora(ra) ;
    -optional<int&> orb(rb) ;
    -
    -def = orb ; // binds 'def' to 'b' through 'rb' wrapped within 'orb'
    -assert ( *def == b ) ;
    -*def = ora ; // changes the value of 'b' to a copy of the value of 'a'
    -assert ( b == a ) ;
    -int c = 3;
    -int& rc = c ;
    -optional<int&> orc(rc) ;
    -ora = orc ; // REBINDS ora to 'c' through 'rc'
    -c = 4 ;
    -assert ( *ora == 4 ) ;
    -
    -
    -
    - -
    - -
    template<U> optional& optional<T (not a ref)>::operator= ( optional<U> const& rhs ) ;
    -
    -

    Effect: Assigns another convertible optional to an optional.

    -

    Postconditions: If rhs is initialized, *this is initialized -and its value is a copy of the value of rhs converted -to type T; else *this is uninitialized. -

    -

    Throws: Whatever T::operator=( U const& ) or T::T( U const& ) throws.

    -

    Notes: If both *this and rhs are initially initialized, -T's assignment operator (from U) is used. If *this is initially initialized but -rhs is uninitialized, T's destructor is called. If *this is initially -uninitialized but rhs is initialized, T's converting constructor (from U) is called. -

    -

    Exception Safety: In the event of an exception, the initialization -state of *this is unchanged and its value unspecified as far as optional -is concerned (it is up to T's operator=()) [If *this is initially -uninitialized and T's converting constructor fails, *this is left -properly uninitialized]

    -

    Example:

    -
    -
    T v;
    -optional<T> opt0(v);
    -optional<U> opt1;
    -
    -opt1 = opt0 ;
    -assert ( *opt1 == static_cast<U>(v) ) ;
    -
    -
    -
    - -
    -
    void optional<T (not a ref)>::reset( T const& v ) ;
    -
    -

    Deprecated: same as operator= ( T const& v) ;

    -
    - -
    -
    void optional<T>::reset() ;
    -
    -

    Deprecated: Same as operator=( none_t n);

    -
    - -
    - -
    T const& optional<T (not a ref)>::operator*() const ;
    -T&       optional<T (not a ref)>::operator*();
    - -
    T const& optional<T (not a ref)>::get() const ;
    -T&       optional<T (not a ref)>::get() ;
    -
    -inline T const& get ( optional<T (not a ref)> const& ) ;
    -inline T&       get ( optional<T (not a ref)> &) ;
    -
    -
    -

    Requirements: *this is initialized

    -

    Returns: A reference to the contained value

    -

    Throws: Nothing.

    -

    Notes: The requirement is asserted via BOOST_ASSERT().

    -

    Example:

    -
    -
    T v ;
    -optional<T> opt ( v );
    -T const& u = *opt;
    -assert ( u == v ) ;
    -T w ;
    -*opt = w ;
    -assert ( *opt == w ) ;
    -
    -
    -
    
    -
    - -
    - - -
    T const& optional<T&>::operator*() const ;
    -T      & optional<T&>::operator*();
    - -
    T const& optional<T&>::get() const ;
    -T&       optional<T&>::get() ;
    -
    -inline T const& get ( optional<T&> const& ) ;
    -inline T&       get ( optional<T&> &) ;
    -
    -
    -

    Requirements: *this is initialized

    -

    Returns: The reference contained.

    -

    Throws: Nothing.

    -

    Notes: The requirement is asserted via BOOST_ASSERT().

    -

    Example:

    -
    -
    T v ;
    -T& vref = v ;
    -optional<T&> opt ( vref );
    -T const& vref2 = *opt;
    -assert ( vref2 == v ) ;
    -++ v ;
    -assert ( *opt == v ) ;
    -
    -
    - -
    - -
    T const& optional<T>::get_value_or( T const& default) const ;
    -T&       optional<T>::get_value_or( T&       default ) ;
    -
    -inline T const& get_optional_value_or ( optional<T> const& o, T const& default ) ;
    -inline T&       get_optional_value_or ( optional<T>&       o, T&       default ) ;
    -
    -
    -

    Returns: A reference to the contained value (which can be itself a reference), if any, or default

    -

    Throws: Nothing.

    -

    Example:

    -
    -
    T v, z ;
    -optional<T> def;
    -T const& y = def.get_value_or(z);
    -assert ( y == z ) ;
    -
    -optional<T> opt ( v );
    -T const& u = get_optional_value_or(opt,z);
    -assert ( u == v ) ;
    -assert ( u != z ) ;
    -
    -
    -
    
    -
    - -
    - -
    T const* optional<T>::get_ptr() const ;
    -T*       optional<T>::get_ptr() ;
    -
    -inline T const* get_pointer ( optional<T> const& ) ;
    -inline T*       get_pointer ( optional<T> &) ;
    -
    -
    -

    Returns: If *this is initialized, a pointer to the contained -value; else 0 (null). -

    -

    Throws: Nothing.

    -

    Notes: If T is a reference type, the pointer is to the referenced object

    -

    Notes: The contained value is permanently stored within *this, so -you should not hold nor delete this pointer. -

    -

    Example:

    -
    -
    int v=123;
    -optional<int> opt(v);
    -optional<int> const copt(v);
    -int* p = opt.get_ptr() ;
    -int const* cp = copt.get_ptr();
    -assert ( p == get_pointer(opt) );
    -assert ( cp == get_pointer(copt) ) ;
    -
    -int& rv = v ;
    -optional<int&> optr(rv);
    -
    -*(optr.get_ptr()) = 456 ;
    -
    -assert ( v == 456 );
    -
    -
    -
    -
    -
    - - -
    - - -
    T const* optional<T>::operator ->() const ;
    -T*       optional<T>::operator ->()       ;
    -
    -
    -

    Requirements: *this is initialized.

    -

    Returns: A pointer to the contained value.

    -

    Throws: Nothing.

    -

    Notes: If T is a reference type, the pointer is to the referenced object

    -

    Notes: The requirement is asserted via BOOST_ASSERT().

    -

    Example:

    -
    -
    struct X { int mdata ; } ;
    -X x ;
    -optional<X> opt (x);
    -opt->mdata = 2 ;
    -
    -X& rx = x ;
    -
    -optional<X&> optr (rx);
    -optr->mdata = 4 ;
    -
    -assert ( x.mdata = 4 ) 
    -
    -
    -
    -
    - - -
    - - -
    optional<T>::operator unspecified-bool-type() const ;
    -
    -

    Returns: An unspecified value which if used on a boolean context is equivalent to (get() != 0)

    -

    Throws: Nothing.

    -
    -
    optional<T> def ;
    -assert ( def == 0 );
    -optional<T> opt ( v ) ;
    -assert ( opt );
    -assert ( opt != 0 );
    -
    -
    -
    - -
    - - -
     bool optional<T>::operator!() ;
    -
    -

    Returns: If *this is uninitialized, true; else false.

    -

    Throws: Nothing.

    -

    Notes: This operator is provided for those compilers which can't use -the unspecified-bool-type operator in certain boolean contexts. -

    -

    Example:

    -
    -
    optional<T> opt ;
    -assert ( !opt );
    -*opt = some_T ;
    -
    -// Notice the "double-bang" idiom here.
    -assert ( !!opt ) ;
    -
    -
    -
    - - -
    - - -
    bool optional<T>::is_initialized() const ;
    -
    -

    Returns: true is the optional is initialized, false -otherwise.

    -

    Throws: Nothing.

    -
    -
    optional<T> def ;
    -assert ( !def.is_initialized() );
    -optional<T> opt ( v ) ;
    -assert ( opt.is_initialized() );
    -
    -
    - -
    - -
    optional<T (not a ref)> make_optional( T const& v )
    -
    -

    Returns: optional<T>(v) for the deduced type T of v.

    -

    Example:

    -
    -
    template<class T> void foo ( optional<T> const& opt ) ;
    -
    -foo ( make_optional(1+1) ) ; // Creates an optional<int>
    -
    -
    -
    - -
    optional<T (not a ref)> make_optional( bool condition, T const& v )
    -
    -

    Returns: optional<T>(condition,v) for the deduced type T of v.

    -

    Example:

    -
    -
    optional<double> calculate_foo()
    -{
    -  double val = compute_foo();
    -  return make_optional(is_not_nan_and_finite(val),val);
    -}
    -
    -optional<double> v = calculate_foo();
    -if ( !v )
    -  error("foo wasn't computed");
    -
    -
    - -
    - - -
    bool operator == ( optional<T> const& x, optional<T> const& y );
    -
    -

    Returns: If both x and y are initialied, (*x == *y). -If only x or y is initialized, false. If both are uninitialized, true.

    -

    Throws: Nothing.

    -

    Notes: Pointers have shallow relational operators while optional has -deep relational operators. Do not use operator == directly in generic code -which expect to be given either an optional<T> or a pointer; -use equal_pointees() instead

    -

    Example:

    -
    -
    T x(12);
    -T y(12);
    -T z(21);
    -optional<T> def0 ;
    -optional<T> def1 ;
    -optional<T> optX(x);
    -optional<T> optY(y);
    -optional<T> optZ(z);
    -
    -// Identity always hold
    -assert ( def0 == def0 );
    -assert ( optX == optX );
    -
    -// Both uninitialized compare equal
    -assert ( def0 == def1 );
    -
    -// Only one initialized compare unequal.
    -assert ( def0 != optX );
    -
    -// Both initialized compare as (*lhs == *rhs)
    -assert ( optX == optY ) ;
    -assert ( optX != optZ ) ;
    -
    -
    -
    - -
    - - -
    bool operator < ( optional<T> const& x, optional<T> const& y );
    -
    -

    Returns: If y is not initialized, false. -If y is initialized and x is not initialized, true. -If both x and y are initialized, (*x < *y).

    -

    Throws: Nothing.

    -

    Notes: Pointers have shallow relational operators while optional has -deep relational operators. Do not use operator < directly in generic code -which expect to be given either an optional<T> or a pointer; -use less_pointees() instead

    -

    Example:

    -
    -
    T x(12);
    -T y(34);
    -optional<T> def ;
    -optional<T> optX(x);
    -optional<T> optY(y);
    -
    -// Identity always hold
    -assert ( !(def < def) );
    -assert ( optX == optX );
    -
    -// Both uninitialized compare equal
    -assert ( def0 == def1 );
    -
    -// Only one initialized compare unequal.
    -assert ( def0 != optX );
    -
    -// Both initialized compare as (*lhs == *rhs)
    -assert ( optX == optY ) ;
    -assert ( optX != optZ ) ;
    -
    -
    -
    - -
    -
    bool operator != ( optional<T> const& x, optional<T> const& y );
    -
    -
    -

    Returns: !( x == y );

    -

    Throws: Nothing.

    -
    - -
    -
    bool operator > ( optional<T> const& x, optional<T> const& y );
    -
    -
    -

    Returns: ( y < x );

    -

    Throws: Nothing.

    -
    - -
    -
    bool operator <= ( optional<T> const& x, optional<T> const& y );
    -
    -
    -

    Returns: !( y<x );

    -

    Throws: Nothing.

    -
    - -
    -
    bool operator >= ( optional<T> const& x, optional<T> const& y );
    -
    -
    -

    Returns: !( x<y );

    -

    Throws: Nothing.

    -
    - -
    -
    -bool operator == ( optional<T> const& x, T const& n );
    -bool operator != ( optional<T> const& x, T const& n );
    -bool operator <  ( optional<T> const& x, T const& n );
    -bool operator >  ( optional<T> const& x, T const& n );
    -bool operator <= ( optional<T> const& x, T const& n );
    -bool operator >= ( optional<T> const& x, T const& n );
    -bool operator == ( T const& n, optional<T> const& y );
    -bool operator != ( T const& n, optional<T> const& y );
    -bool operator <  ( T const& n, optional<T> const& y );
    -bool operator >  ( T const& n, optional<T> const& y );
    -bool operator <= ( T const& n, optional<T> const& y );
    -bool operator >= ( T const& n, optional<T> const& y );
    -
    -
    -

    Returns: The result obtained by replacing the argument 'n' by optional<T>(n).

    -
    - -
    -
    -bool operator == ( optional<T> const& x, none_t n );
    -bool operator != ( optional<T> const& x, none_t n );
    -bool operator <  ( optional<T> const& x, none_t n );
    -bool operator >  ( optional<T> const& x, none_t n );
    -bool operator <= ( optional<T> const& x, none_t n );
    -bool operator >= ( optional<T> const& x, none_t n );
    -bool operator == ( none_t n, optional<T> const& y );
    -bool operator != ( none_t n, optional<T> const& y );
    -bool operator <  ( none_t n, optional<T> const& y );
    -bool operator >  ( none_t n, optional<T> const& y );
    -bool operator <= ( none_t n, optional<T> const& y );
    -bool operator >= ( none_t n, optional<T> const& y );
    -
    -
    -

    Returns: The result obtained by replacing the argument 'n' by optional<T>().

    -
    -
    - -
    void swap ( optional<T>& x, optional<T>& y );
    - -
    -

    Effect: If both x and y are initialized, calls swap(*x,*y) using std::swap.
    -If only one is initialized, say x, calls: y = *x; x = boost:none;
    -If none is initialized, does nothing.

    -

    Postconditions: The states of x and y interchanged.

    -

    Throws: If both are initialized, whatever swap(T&,T&) throws. -If only one is initialized, whatever T::T ( T const& ) throws.

    -

    Notes: If both are initialized, swap(T&,T&) is used unqualified but with std::swap introduced in scope.
    -If only one is initialized, T::~T() and T::T( T const& ) is called.

    -

    Exception Safety: If both are initialized, this operation has the exception -safety guarantees of swap(T&,T&).
    -If only one is initialized, it has the same basic guarantee as optional<T>::operator=( T const& ).

    -

    Example:

    -
    -
    T x(12);
    -T y(21);
    -optional<T> def0 ;
    -optional<T> def1 ;
    -optional<T> optX(x);
    -optional<T> optY(y);
    -
    -boost::swap(def0,def1); // no-op
    -
    -boost::swap(def0,optX);
    -assert ( *def0 == x );
    -assert ( !optX );
    -
    -boost::swap(def0,optX); // Get back to original values
    -
    -boost::swap(optX,optY);
    -assert ( *optX == y );
    -assert ( *optY == x );
    -
    -
    -
    -
    -
    - -

    Examples

    - -

    Optional return values

    -
    optional<char> get_async_input()
    -{
    -  if ( !queue.empty() )
    -       return optional<char>(queue.top());
    -  else return optional<char>(); // uninitialized
    -}
    -
    -void receive_async_message()
    -{
    -  optional<char> rcv ;
    -  // The safe boolean conversion from 'rcv' is used here.
    -  while ( (rcv = get_async_input()) && !timeout() )
    -    output(*rcv);
    -}
    -
    - -

    Optional local variables

    -
    optional<string> name ;
    -if ( database.open() )
    -{
    -  name = database.lookup(employer_name) ;
    -}
    -else
    -{
    -  if ( can_ask_user )
    -    name = user.ask(employer_name) ;
    -}
    -
    -if ( name )
    -     print(*name);
    -else print("employer's name not found!");
    -
    - -

    Optional data members

    -
    class figure
    -{
    -  public:
    -
    -    figure()
    -    {
    -      // data member 'm_clipping_rect' is uninitialized at this point.
    -    }
    -
    -    void clip_in_rect ( rect const& rect )
    -      {
    -         ....
    -         m_clipping_rect = rect ; // initialized here.
    -      }
    -
    -    void draw ( canvas& cvs )
    -      {
    -        if ( m_clipping_rect )
    -          do_clipping(*m_clipping_rect);
    -
    -        cvs.drawXXX(..);
    -      }
    -
    -    // this can return NULL.
    -    rect const* get_clipping_rect() { return get_pointer(m_clipping_rect); }
    -
    -  private :
    -
    -    optional<rect> m_clipping_rect ;
    -
    -};
    -
    -

    Bypassing expensive unnecessary default construction

    -
    class ExpensiveCtor { ... } ;
    -class Fred
    -{
    -  Fred() : mLargeVector(10000) {}
    -
    -  std::vector< optional<ExpensiveCtor> > mLargeVector ;
    -} ;
    -
    - -
    - -

    Optional references

    -

    This library allows the template parameter T to be of reference type: T&, and -to some extent, T const&.

    - -

    However, since references are not real objects some restrictions apply and -some operations are not available in this case:

    - -
      -
    • Converting constructors
    • -
    • Converting assignment
    • -
    • InPlace construction
    • -
    • InPlace assignment
    • -
    -

    Also, even though optional<T&> treats it wrapped pseudo-object much as a real -value, a true real reference is stored, thus aliasing can ocurr:

    - -
      -
    • Copies of optional<T&> copies the reference, but all copied references - will nonetheless reefer to the same object.
    • -
    • Value-access provides access to the referenced object rather - than the reference itself.
    • -
    • Pointer-access provides a pointer to the referenced object rather - than a pointer to the reference itself.
    • -
    - -
    -

    Rebinding semantics for assignment of optional -references

    -

    If you assign to an uninitialized optional<T&> the effect is to bind (for the first time) to the object. -Clearly, there is no other choice.

    -
    int x = 1 ;
    -int& rx = x ;
    -optional<int&> ora ;
    -optional<int&> orb(rx) ;
    -ora = orb ; // now 'ora' is bound to 'x' through 'rx'
    -*ora = 2 ; // Changes value of 'x' through 'ora'
    -assert(x==2); 
    -
    -

    If you assign to a bare C++ reference, the assignment is forwarded to the -referenced object; it's value changes but the reference is never rebound.

    -
    int a = 1 ;
    -int& ra = a ;
    -int b = 2 ;
    -int& rb = b ;
    -ra = rb ; // Changes the VALUE of 'a' to that of 'b'
    -assert(a==b);
    -b = 3 ;
    -assert(ra!=b); // 'ra' is not rebound to 'b'
    -
    -

    Now, if you assign to an initialized optional<T&>, the effect is to rebind to the new object instead of assigning the referee. This is unlike -bare C++ references.

    -
    int a = 1 ;
    -int b = 2 ;
    -int& ra = a ;
    -int& rb = b ;
    -optional<int&> ora(ra) ;
    -optional<int&> orb(rb) ;
    -ora = orb ; // 'ora' is rebound to 'b'
    -*ora = 3 ; // Changes value of 'b' (not 'a')
    -assert(a==1); 
    -assert(b==3); 
    -
    -

    Rationale:

    -

    Rebinding semantics for the assignment of initialized optional -references has been chosen to provide consistency among initialization -states even at the expense of lack of consistency with the semantics of bare -C++ references.
    -It is true that optional<U> strives to behave as much as possible as U does -whenever it is initialized; but in the case when U is T&, doing so would result -in inconsistent behavior w.r.t to the lvalue initialization state.

    -

    Consider the following code :

    -
    -int x = 1 ;
    -int& rx = x ;
    -void foo ( optional<int&> & outer )
    -{
    -  optional<int&> b(rx);
    -  outer = b ;
    -}
    -
    -

    What should the assignment to 'outer' do?
    -If 'outer' is uninitialized, the answer is clear: it should bind to 'x' (so we now have -a second reference to 'x').
    -But what if 'outer' is already initialized?
    -The assignment could change the value of the -referenced object (whatever that is), but doing that would be inconsistent with the uninitialized case -and then you wouldn't be able to reason at compile time about all the references to x since -the appearance of a new reference to it would depend on wheter the lvalue ('outer') -is initialized or not.

    -

    Arguably, if rebinding the reference to another object is wrong for your code, then is -likely that binding it for the fist time via assignment instead of intialization is also wrong. -In that case, you can always just assign the value to the referenced object directly via -the access operator *opt=value.

    -

    If rebinding is wrong but first-time binding -isn't (via assignment), you can always work around the rebinding semantics using a discriminator:

    -
    -if ( !opt )
    -      opt = value ; // first-time binding
    -else *opt = value ; // assign to referee without rebinding 
    -
    - -
    - -

    none_t and none

    -

    optional<T> supports uninitialized states with a convenient syntax via a constant of -the implementation-defined type boost::none_t, identified as boost::none.

    -

    Starting with Boost version 1.34.0, both boost::none_t and boost::none are -included in boost/none.hpp, which is automatically included by boost/optional/optional.hpp -

    -

    This contant is similar in purpose to NULL, except that is not a null pointer value. You can use it to initialize -an optional<T> instance, which has the same effect of a default constructor, and you can assign it which has the -effect of reseting the optional<T> instance. You can also use it in relational operators to make the predicate expression -more clear.

    -

    Here are some typical examples:

    -
    -#include "boost/optional/optional.hpp" // boost/none.hpp is included automatically
    -
    -boost::optional<int> foo ( int a )
    -{
    -  return some_condition(a) ? boost::make_optional(a) : boost::none ;  
    -  
    -  // NOTE: in real code you can just use this: make_optional(some_condition(a), a ) 
    -}
    -
    -boost::optional<int> opt = boost::none ;
    -
    -if ( opt == boost::none )
    -  opt = foo(123);
    -
    -opt = boost::none ;
    -
    -
    - -
    - -

    In-Place Factories

    -

    -One of the typical problems with wrappers and containers is that their -interfaces usually provide an operation to initialize or assign the contained -object as a copy of some other object. This not only requires the underlying -type to be Copy Constructible, but also requires the existence of a fully -constructed object, often temporary, just to follow the copy from:

    -
    struct X
    -{
    -  X ( int, std:::string ) ;
    -} ;
    -
    class W
    -{
    -  X wrapped_ ;
    -
    -public:
    -
    -  W ( X const& x ) : wrapped_(x) {}
    -} ;
    -
    void foo()
    -{
    -  // Temporary object created.
    -  W ( X(123,"hello") ) ;
    -}
    -
    -

    A solution to this problem is to support direct construction of the contained -object right in the container's storage.
    -In this scheme, the user only needs to supply the arguments to the constructor -to use in the wrapped object construction.

    -
    class W
    -{
    -  X wrapped_ ;
    -
    -public:
    -
    -  W ( X const& x ) : wrapped_(x) {}
    -  W ( int a0, std::string a1) : wrapped_(a0,a1) {}
    -} ;
    -
    void foo()
    -{
    -  // Wrapped object constructed in-place
    -  // No temporary created.
    -  W (123,"hello") ;
    -}
    -
    -

    A limitation of this method is that it doesn't scale well to wrapped objects with multiple -constructors nor to generic code were the constructor overloads are unknown.

    -

    The solution presented in this library is the family of InPlaceFactories and TypedInPlaceFactories.
    -These factories are a family of classes which encapsulate an increasing number of arbitrary -constructor parameters and supply a method to construct an object of a given type using those -parameters at an address specified by the user via placement new.

    -

     For example, one member of this family looks like:

    -
    template<class T,class A0, class A1>
    -class TypedInPlaceFactory2
    -{
    -  A0 m_a0 ; A1 m_a1 ;
    -
    -public:
    -
    -  TypedInPlaceFactory2( A0 const& a0, A1 const& a1 ) : m_a0(a0), m_a1(a1) {}
    -
    -  void construct ( void* p ) { new (p) T(m_a0,m_a1) ; }
    -} ;
    -
    -

    A wrapper class aware of this can use it as:

    -
    class W
    -{
    -  X wrapped_ ;
    -
    -public:
    -
    -  W ( X const& x ) : wrapped_(x) {}
    -  W ( TypedInPlaceFactory2 const& fac ) { fac.construct(&wrapped_) ; }
    -} ;
    -
    void foo()
    -{
    -  // Wrapped object constructed in-place via a TypedInPlaceFactory.
    -  // No temporary created.
    -  W ( TypedInPlaceFactory2<X,int,std::string&rt;(123,"hello")) ;
    -}
    -
    -

    The factories are divided in two groups:

      -
    • TypedInPlaceFactories: those which take the target type as a primary template parameter.
    • -
    • InPlaceFactories: those with a template construct(void*) member function taking the target type.
    • -
    -

    Within each group, all the family members differ only in the number of parameters allowed.

    -

    -

    This library provides an overloaded set of helper template functions to construct these factories -without requiring unnecessary template parameters:

    -
    template<class A0,...,class AN>
    -InPlaceFactoryN <A0,...,AN> in_place ( A0 const& a0, ..., AN const& aN) ;
    -
    -template<class T,class A0,...,class AN>
    -TypedInPlaceFactoryN <T,A0,...,AN> in_place ( T const& a0, A0 const& a0, ..., AN const& aN) ;
    - -

    In-place factories can be used generically by the wrapper and user as follows:

    -
    class W
    -{
    -  X wrapped_ ;
    -
    -public:
    -
    -  W ( X const& x ) : wrapped_(x) {}
    -
    -  template
    -  W ( InPlaceFactory const& fac ) { fac.template <X>construct(&wrapped_) ; }
    -
    -} ;
    -
    void foo()
    -{
    -  // Wrapped object constructed in-place via a InPlaceFactory.
    -  // No temporary created.
    -  W ( in_place(123,"hello") ) ;
    -}
    -
    -

    The factories are implemented in the headers: in_place_factory.hpp and typed_in_place_factory.hpp

    - -
    - -

    A note about optional<bool>

    -

    optional<bool> should be used with special caution and consideration.

    -

    First, it is functionally similar to a tristate boolean (false,maybe,true) —such as boost::tribool—except that in a tristate boolean, -the maybe state represents a valid value, unlike the corresponding state -of an uninitialized optional<bool>.
    -It should be carefully considered if an optional<bool> instead of a tribool is really needed

    -

    Second, optional<> provides a simple way to test initialization state: an implicit conversion to a type that evaluates as a 'bool' in a boolean context.
    -Using optional<bool> can lead to subtle errors due to this implicit conversion:

    -
    void foo ( bool v ) ;
    -void bar()
    -{
    -  optional<bool> v = try();
    -
    -  // The following intended to pass the value of 'v' to foo():
    -  foo(v);
    -  // But instead, the initialization state is passed
    -  // due to a typo: it should have been foo(*v).
    -}
    -
    -

    The only implicit conversion is to bool, and it is safe in the sense that typical -integral promotions don't apply (i.e. if foo() takes an 'int' instead, it won't compile).


    - -

    Exception Safety Guarantees

    - -

    Assignment:

    -

    IMPORTANT NOTE: This changed in 1.33.1 with respect to previous versions

    -

    Because of the current implementation (see Implementation Notes), all -of the assignment methods:

    -
      -
    • optional<T>::operator= ( optional<T> const& ) -
    • -
    • optional<T>::operator= ( T const& )
    • -
    • template<class U> optional<T>::operator= ( optional<U> const& ) -
    • -
    • template<class InPlaceFactory> optional<T>::operator= ( - InPlaceFactory const& )
    • -
    • template<class TypedInPlaceFactory> optional<T>::operator= ( - TypedInPlaceFactory const& )
    • -
    -

    cannot offer any exception safety guarantee beyond that provided by T::operator=( T const& )

    -

    On the other hand, the uninitializing methods:

    -
      -
    • optional<T>::operator= ( detail::none_t )
    • -
    -

    Provides the no-throw guarantee (assuming a no-throw T::~T()) becuse it only destroys the stored object.

    - -

    Swap:

    -

    void swap( optional<T>&, optional<T>& ) has the same exception guarantee as swap(T&,T&) when both optionals are initialized.
    -If only one of the optionals is initialized, it gives the same exception guarantee as T::operator=( T const& ) (since optional<T>::operator=( none_t ) doesn't throw).
    -If none of the optionals is initialized, it has no-throw guarantee since it is a no-op.

    - -
    - -

    Type requirements

    -

    In general, T must be Copy Constructible and have a no-throw destructor. The copy-constructible requirement is not needed -if InPlaceFactories are used.
    -T is not required to be Default Constructible

    - -
    - -

    Implementation Notes

    -

    optional<T> is currently implemented - using a custom aligned storage facility built from alignment_of and type_with_alignment (both from Type Traits). - It uses a separate boolean flag to indicate the initialization state.

    -

    Placement new with T's copy constructor and T's destructor - is explicitly used to initialize and destroy optional values. This allows T's default constructor to be effectively by-passed.

    -

    If assignment is used and the lvalue optional is uninitialized, T's copy constructor is used. However, if it is already initialized, T's assignment operator is used. This prevents optional from offering any exception guarantee stronger than the one offered by the type T itself

    - -
    - -

    Dependencies and Portability

    - -

    The implementation uses type_traits/alignment_of.hpp and type_traits/type_with_alignment.hpp

    - -
    - -

    Acknowledgments

    -

    Pre-formal review:

    -
    -

    Peter Dimov suggested the name 'optional', and was the first to point out the - need for aligned storage
    - Douglas Gregor developed 'type_with_alignment', and later Eric Friedman coded - 'aligned_storage', which are the core of the optional class implementation.
    - Andrei Alexandrescu and Brian Parker also worked with aligned storage techniques - and their work influenced the current implementation.
    - Gennadiy Rozental made extensive and important comments which shaped the design.
    - Vesa Karvonen and Douglas Gregor made quite useful comparisons between optional, - variant and any; and made other relevant comments. Douglas Gregor and Peter - Dimov commented on comparisons and evaluation in boolean contexts.
    - Eric Friedman helped understand the issues involved with aligned storage, move/copy - operations and exception safety.
    - Many others have participated with useful comments: Aleksey Gurotov, Kevlin - Henney, David Abrahams, and others I can't recall.

    -
    -

    Post-formal review:

    -
    -

    William Kempf carefully considered the originally proposed interface and - suggested the new interface which is currently used. He also started and fueled - the discussion about the analogy optional<>/smart pointer and about - relational operators.
    - Peter Dimov, Joel de Guzman, David Abrahams, Tanton Gibbs and Ian Hanson focused - on the relational semantics of optional (originally undefined); concluding - with the fact that the pointer-like interface doesn't make it a pointer so - it shall have deep relational operators.
    - Augustus Saunders also explored the different relational semantics between - optional<> and a pointer and developed the OptionalPointee concept as - an aid against potential conflicts on generic code.
    - Joel de Guzman noticed that optional<> can be seen as an API on top - of variant<T,nil_t>.
    - Dave Gomboc explained the meaning and usage of the Haskell analog to optional<>: - the Maybe type constructor (analogy originally pointed out by David Sankel).
    - Other comments were posted by Vincent Finn, Anthony Williams, Ed Brey, Rob - Stewart, and others.
    - Joel de Guzman made the case for the support of references and helped with - the proper semantics.
    - Mat Marcus shown the virtues of a value-oriented interface, influencing the - current design, and contributed the idea of "none".

    -
    -
    - -

    Revised March 27, 2007

    -

    © Copyright Fernando Luis Cacciola Carballal, 2003-2007

    -

    Use, modification, and distribution are subject to the Boost Software -License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)

    -

    Developed by Fernando Cacciola, -the latest version of this file can be found at www.boost.org, and the boost discussion lists

    - - \ No newline at end of file diff --git a/doc/optional.qbk b/doc/optional.qbk index 388f686..7388b5f 100644 --- a/doc/optional.qbk +++ b/doc/optional.qbk @@ -40,11 +40,6 @@ Distributed under the Boost Software License, Version 1.0. [/ Icons ] -[def __NOTE__ [$images/note.png]] -[def __ALERT__ [$images/caution.png]] -[def __DETAIL__ [$images/note.png]] -[def __TIP__ [$images/tip.png]] -[def __QUESTION_MARK__ [$images/question.png]] [def __SPACE__ [$images/space.png]] [def __GO_TO__ [$images/callouts/R.png]] diff --git a/doc/reference.qbk b/doc/reference.qbk index 73993b3..c50b61a 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -126,6 +126,7 @@ Because `T` might be of reference type, in the sequel, those entries whose semantic depends on `T` being of reference type or not will be distinguished using the following convention: + * If the entry reads: `optional`, the description corresponds only to the case where `T` is not of reference type. * If the entry reads: `optional`, the description corresponds only to From 472a68c92012d523f9df93f76f233a5e781cb490 Mon Sep 17 00:00:00 2001 From: Matias Capeletto Date: Thu, 14 Feb 2008 17:44:21 +0000 Subject: [PATCH 03/36] redirect optional docs to new version [SVN r43248] --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index ed59314..3031e05 100644 --- a/index.html +++ b/index.html @@ -1,11 +1,11 @@ - + Automatic redirection failed, please go to -doc/optional.html
    -

    © Copyright Beman Dawes, 2001

    +doc/html/index.html
    +

    � Copyright Beman Dawes, 2001

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)

    From 66c366d18a416fd1f3500581ef44a0f9d584a74b Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 25 Apr 2008 16:50:32 +0000 Subject: [PATCH 04/36] Improved swap for optional, co-written by Thorsten and Fernando: added support for tweaking whether swap should use T's default constructor. Added swap member function. Discussed at Boost developers' mailing list, "[optional] problems with swap()", http://lists.boost.org/Archives/boost/2008/04/135882.php [SVN r44766] --- include/boost/optional/optional.hpp | 104 ++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 29 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index ebcf17a..f23df09 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,6 +9,9 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // +// Revisions: +// 25 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen +// #ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP #define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP @@ -19,6 +22,7 @@ #include "boost/assert.hpp" #include "boost/type.hpp" #include "boost/type_traits/alignment_of.hpp" +#include "boost/type_traits/has_nothrow_constructor.hpp" #include "boost/type_traits/type_with_alignment.hpp" #include "boost/type_traits/remove_reference.hpp" #include "boost/type_traits/is_reference.hpp" @@ -28,6 +32,7 @@ #include "boost/detail/reference_content.hpp" #include "boost/none.hpp" #include "boost/utility/compare_pointees.hpp" +#include "boost/utility/in_place_factory.hpp" #include "boost/optional/optional_fwd.hpp" @@ -571,6 +576,14 @@ class optional : public optional_detail::optional_base return *this ; } + void swap( optional & arg ) + { + // allow for Koenig lookup + using std::swap ; + swap(*this, arg); + } + + // Returns a reference to the value if this is initialized, otherwise, // the behaviour is UNDEFINED // No-throw @@ -878,44 +891,77 @@ namespace optional_detail { #define BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE #endif -// optional's swap: -// If both are initialized, calls swap(T&, T&). If this swap throws, both will remain initialized but their values are now unspecified. -// If only one is initialized, calls U.reset(*I), THEN I.reset(). -// If U.reset(*I) throws, both are left UNCHANGED (U is kept uinitialized and I is never reset) -// If both are uninitialized, do nothing (no-throw) -template -inline -void optional_swap ( optional& x, optional& y ) -{ - if ( !x && !!y ) + template struct swap_selector; + + template<> + struct swap_selector { - x.reset(*y); - y.reset(); - } - else if ( !!x && !y ) - { - y.reset(*x); - x.reset(); - } - else if ( !!x && !!y ) - { -// GCC > 3.2 and all other compilers have the using declaration at function scope (FLC) + template + static void optional_swap ( optional& x, optional& y ) + { + bool hasX = x; + bool hasY = y; + + if ( !hasX && !hasY ) + return; + + if( !hasX ) + x = boost::in_place(); + else if ( !hasY ) + y = boost::in_place(); + + // GCC > 3.2 and all other compilers have the using declaration at function scope (FLC) #ifndef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE - // allow for Koenig lookup - using std::swap ; + // allow for Koenig lookup + using std::swap ; #endif - swap(*x,*y); - } -} + swap(*x,*y); + + if( !hasX ) + y = boost::none ; + else if( !hasY ) + x = boost::none ; + } + }; + + template<> + struct swap_selector + { + template + static void optional_swap ( optional& x, optional& y ) + { + if ( !x && !!y ) + { + x = *y; + y = boost::none ; + } + else if ( !!x && !y ) + { + y = *x ; + x = boost::none ; + } + else if ( !!x && !!y ) + { + // GCC > 3.2 and all other compilers have the using declaration at function scope (FLC) + #ifndef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE + // allow for Koenig lookup + using std::swap ; + #endif + swap(*x,*y); + } + } + }; } // namespace optional_detail +template +struct optional_swap_should_use_default_constructor : has_nothrow_default_constructor {} ; + template inline void swap ( optional& x, optional& y ) { - optional_detail::optional_swap(x,y); + optional_detail::swap_selector::value>::optional_swap(x, y); } - } // namespace boost #endif From 1afed544db9c2ede9fe1dc4b514a669e81174b44 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 25 Apr 2008 16:52:34 +0000 Subject: [PATCH 05/36] Added unit tests, testing optional swap improvements of revision [44766] [SVN r44767] --- test/optional_test.cpp | 187 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 186 insertions(+), 1 deletion(-) diff --git a/test/optional_test.cpp b/test/optional_test.cpp index 02ed181..8c6811b 100644 --- a/test/optional_test.cpp +++ b/test/optional_test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,6 +9,9 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // +// Revisions: +// 25 Apr 2008 (added more swap tests) +// #include #include #include @@ -16,6 +19,8 @@ #define BOOST_ENABLE_ASSERT_HANDLER #include "boost/bind/apply.hpp" // Included just to test proper interaction with boost::apply<> as reported by Daniel Wallin +#include "boost/mpl/bool.hpp" +#include "boost/mpl/bool_fwd.hpp" // For mpl::true_ and mpl::false_ #include "boost/optional/optional.hpp" @@ -927,6 +932,185 @@ void test_conversions2() BOOST_CHECK(*get(&opt1) == static_cast(f)); } + +namespace optional_swap_test +{ + class default_ctor_exception : public std::exception {} ; + class copy_ctor_exception : public std::exception {} ; + class assignment_exception : public std::exception {} ; + + // + // Base class for swap test classes. Its assignment should not be called, when swapping + // optional objects. (The default std::swap would do so.) + // + class base_class_with_forbidden_assignment + { + public: + base_class_with_forbidden_assignment & operator=(const base_class_with_forbidden_assignment &) + { + BOOST_CHECK(!"The assignment should not be used while swapping!"); + throw assignment_exception(); + } + + virtual ~base_class_with_forbidden_assignment() {} + }; + + // + // Class without default constructor + // + class class_without_default_ctor : public base_class_with_forbidden_assignment + { + public: + char data; + explicit class_without_default_ctor(char arg) : data(arg) {} + }; + + // + // Class whose default constructor should not be used by optional::swap! + // + class class_whose_default_ctor_should_not_be_used : public base_class_with_forbidden_assignment + { + public: + char data; + explicit class_whose_default_ctor_should_not_be_used(char arg) : data(arg) {} + + class_whose_default_ctor_should_not_be_used() + { + BOOST_CHECK(!"This default constructor should not be used while swapping!"); + throw default_ctor_exception(); + } + }; + + // + // Class whose default constructor should be used by optional::swap. + // Its copy constructor should be avoided! + // + class class_whose_default_ctor_should_be_used : public base_class_with_forbidden_assignment + { + public: + char data; + explicit class_whose_default_ctor_should_be_used(char arg) : data(arg) { } + + class_whose_default_ctor_should_be_used() : data('\0') { } + + class_whose_default_ctor_should_be_used(const class_whose_default_ctor_should_be_used &) + { + BOOST_CHECK(!"This copy constructor should not be used while swapping!"); + throw copy_ctor_exception(); + } + }; + + void swap(class_whose_default_ctor_should_not_be_used & lhs, class_whose_default_ctor_should_not_be_used & rhs) + { + std::swap(lhs.data, rhs.data); + } + + void swap(class_whose_default_ctor_should_be_used & lhs, class_whose_default_ctor_should_be_used & rhs) + { + std::swap(lhs.data, rhs.data); + } + + void swap(class_without_default_ctor & lhs, class_without_default_ctor & rhs) + { + std::swap(lhs.data, rhs.data); + } + +} // End of namespace optional_swap_test. + +namespace boost { + + // + // Compile time tweaking on whether or not swap should use the default constructor: + // + template <> struct optional_swap_should_use_default_constructor< + ::optional_swap_test::class_whose_default_ctor_should_be_used> : mpl::true_ {} ; + + template <> struct optional_swap_should_use_default_constructor< + ::optional_swap_test::class_whose_default_ctor_should_not_be_used> : mpl::false_ {} ; +} + + +// +// Tests whether the swap function works properly for optional. +// Assumes that T has one data member, of type char. +// Returns true iff the test is passed. +// +template +bool test_swap_function( T const* ) +{ + const boost::unit_test::counter_t counter_before_test = boost::minimal_test::errors_counter(); + try + { + optional obj1; + optional obj2('a'); + + // Test if obj1 and obj2 are properly initialized. + BOOST_CHECK(!obj1); + BOOST_CHECK(!!obj2 && obj2->data == 'a'); + + // Call non-member swap + swap(obj1, obj2); + + // Test if obj1 and obj2 are really swapped + BOOST_CHECK(!!obj1 && obj1->data == 'a'); + BOOST_CHECK(!obj2); + } + catch(const std::exception &) + { + // The swap function should not throw, for our test cases. + return false ; + } + return boost::minimal_test::errors_counter() == counter_before_test ; +} + +// +// Tests whether the optional::swap member function works properly. +// Assumes that T has one data member, of type char. +// Returns true iff the test is passed. +// +template +bool test_swap_member_function( T const* ) +{ + const boost::unit_test::counter_t counter_before_test = boost::minimal_test::errors_counter(); + try + { + optional obj1; + optional obj2('a'); + + // Test if obj1 and obj2 are properly initialized. + BOOST_CHECK(!obj1); + BOOST_CHECK(!!obj2 && obj2->data == 'a'); + + // Call member swap + obj1.swap(obj2); + + // Test if obj1 and obj2 are really swapped + BOOST_CHECK(!!obj1 && obj1->data == 'a'); + BOOST_CHECK(!obj2); + } + catch(const std::exception &) + { + // The optional::swap member function should not throw, for our test cases. + return false ; + } + return boost::minimal_test::errors_counter() == counter_before_test ; +} + + +// +// Tests compile time tweaking of swap, by means of +// optional_swap_should_use_default_constructor. +// +void test_swap_tweaking() +{ + BOOST_CHECK( test_swap_function( ARG(optional_swap_test::class_without_default_ctor) ) ); + BOOST_CHECK( test_swap_function( ARG(optional_swap_test::class_whose_default_ctor_should_be_used) ) ); + BOOST_CHECK( test_swap_function( ARG(optional_swap_test::class_whose_default_ctor_should_not_be_used) ) ); + BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::class_without_default_ctor) ) ); + BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::class_whose_default_ctor_should_be_used) ) ); + BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::class_whose_default_ctor_should_not_be_used) ) ); +} + int test_main( int, char* [] ) { try @@ -936,6 +1120,7 @@ int test_main( int, char* [] ) test_no_implicit_conversions(); test_conversions1(); test_conversions2(); + test_swap_tweaking(); } catch ( ... ) { From 951b49f992d2ae205fedf7e6a254ad54c1ad6cc5 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 27 Apr 2008 07:39:49 +0000 Subject: [PATCH 06/36] Merge in documentation fixes. Apart from the change to optional's documenation Jamfile, which I included by mistake. Fixes #1659, #1661, #1684, #1685, 1687, #1690, #1801 I wrote about this at: http://lists.boost.org/Archives/boost/2008/04/136405.php Merged revisions 44585-44806 via svnmerge from https://svn.boost.org/svn/boost/branches/doc ........ r44585 | danieljames | 2008-04-19 16:25:27 +0100 (Sat, 19 Apr 2008) | 2 lines Fix broken link to vacpp in bjam docs. Refs #1512 ........ r44586 | danieljames | 2008-04-19 16:27:36 +0100 (Sat, 19 Apr 2008) | 2 lines Fix broken link to bcpp in bjam docs. Refs #1513 ........ r44587 | danieljames | 2008-04-19 16:33:58 +0100 (Sat, 19 Apr 2008) | 2 lines DateTime documentation - Fix a link to the serialization library. Refs #1659 ........ r44588 | danieljames | 2008-04-19 16:35:36 +0100 (Sat, 19 Apr 2008) | 2 lines Fix some links in interprocess & intrusive. Refs #1661 ........ r44589 | danieljames | 2008-04-19 16:37:39 +0100 (Sat, 19 Apr 2008) | 2 lines Fix some links in the python docs. Refs #1684. ........ r44590 | danieljames | 2008-04-19 16:38:29 +0100 (Sat, 19 Apr 2008) | 2 lines Work around a quickbook bug which is affecting the python docs. Refs #1684. ........ r44591 | danieljames | 2008-04-19 16:39:34 +0100 (Sat, 19 Apr 2008) | 2 lines Fix a broken link in the numeric conversion docs. Refs #1685 ........ r44592 | danieljames | 2008-04-19 16:40:45 +0100 (Sat, 19 Apr 2008) | 2 lines Fix some links in the optional docs. Refs #1687 ........ r44593 | danieljames | 2008-04-19 16:42:09 +0100 (Sat, 19 Apr 2008) | 2 lines Fix link to the hash documentation from bimap. Refs #1690 ........ r44599 | danieljames | 2008-04-19 18:07:33 +0100 (Sat, 19 Apr 2008) | 2 lines Fix a typo in the format library. Refs #1801 ........ r44600 | danieljames | 2008-04-19 19:20:59 +0100 (Sat, 19 Apr 2008) | 1 line Initialise svnmerge. ........ r44641 | danieljames | 2008-04-20 18:59:47 +0100 (Sun, 20 Apr 2008) | 2 lines Fix the lincense url in shared container iterator documentation. ........ r44642 | danieljames | 2008-04-20 19:00:00 +0100 (Sun, 20 Apr 2008) | 2 lines Fix image link in the mpi documentation. ........ r44643 | danieljames | 2008-04-20 19:00:11 +0100 (Sun, 20 Apr 2008) | 2 lines Fix a typo in the spirit docs. ........ r44644 | danieljames | 2008-04-20 19:00:23 +0100 (Sun, 20 Apr 2008) | 2 lines Escape the slash so that quickbook doesn't think it the start of an italic section, and mess up the link. Refs #1844 ........ r44647 | danieljames | 2008-04-20 19:39:47 +0100 (Sun, 20 Apr 2008) | 2 lines Fix another typo in spirit docs. ........ [SVN r44807] --- doc/optional.qbk | 2 +- index.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/optional.qbk b/doc/optional.qbk index 7388b5f..5217e49 100644 --- a/doc/optional.qbk +++ b/doc/optional.qbk @@ -22,7 +22,7 @@ Distributed under the Boost Software License, Version 1.0. [/ Cited Boost resources ] [def __BOOST_VARIANT__ [@../../../variant/index.html Boost.Variant]] -[def __BOOST_TRIBOOL__ [@../../../tribool/index.html boost::tribool]] +[def __BOOST_TRIBOOL__ [@../../../../doc/html/tribool.html boost::tribool]] [def __OPTIONAL_POINTEE__ [@../../../utility/OptionalPointee.html OptionalPointee]] [def __COPY_CONSTRUCTIBLE__ [@../../../utility/CopyConstructible.html Copy Constructible]] diff --git a/index.html b/index.html index 3031e05..84b7c93 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,10 @@ Automatic redirection failed, please go to -doc/html/index.html
    +doc/html/index.html

    � Copyright Beman Dawes, 2001

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)

    - \ No newline at end of file + From a4572497bef424f4db0ceb4fe75661ce0218611a Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sun, 27 Apr 2008 21:07:10 +0000 Subject: [PATCH 07/36] Added forward declaration of optional's boost::swap overload, as mentioned at http://article.gmane.org/gmane.comp.lib.boost.devel/174350 "Re: [optional] problems with swap()" [SVN r44825] --- include/boost/optional/optional_fwd.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/boost/optional/optional_fwd.hpp b/include/boost/optional/optional_fwd.hpp index 2cf4fa6..f36bebf 100644 --- a/include/boost/optional/optional_fwd.hpp +++ b/include/boost/optional/optional_fwd.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,6 +9,9 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // +// Revisions: +// 27 Apr 2008 (added forward declaration of boost::swap overload) Niels Dekker +// #ifndef BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP #define BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP @@ -16,6 +19,8 @@ namespace boost { template class optional ; +template void swap ( optional& , optional& ) ; + } // namespace boost #endif From 74674531c880f34773ecfc9c89e7198b84e6fd72 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sun, 27 Apr 2008 21:09:50 +0000 Subject: [PATCH 08/36] Replaced "using std::swap" by "using boost::swap" within optional::swap member function, hoping to fix GCC test failures, as mentioned at http://article.gmane.org/gmane.comp.lib.boost.devel/174350 "Re: [optional] problems with swap()" [SVN r44826] --- include/boost/optional/optional.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index f23df09..01db469 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -10,7 +10,7 @@ // fernando_cacciola@hotmail.com // // Revisions: -// 25 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen +// 27 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen // #ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP #define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP @@ -579,7 +579,7 @@ class optional : public optional_detail::optional_base void swap( optional & arg ) { // allow for Koenig lookup - using std::swap ; + using boost::swap ; swap(*this, arg); } From 43eac5bb126413fdc31ba04c18b79dda3c6b603f Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sat, 10 May 2008 14:42:49 +0000 Subject: [PATCH 09/36] Added forward declaration of boost::optional_swap_should_use_default_constructor. [SVN r45264] --- include/boost/optional/optional_fwd.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/optional/optional_fwd.hpp b/include/boost/optional/optional_fwd.hpp index f36bebf..a74fe10 100644 --- a/include/boost/optional/optional_fwd.hpp +++ b/include/boost/optional/optional_fwd.hpp @@ -10,7 +10,7 @@ // fernando_cacciola@hotmail.com // // Revisions: -// 27 Apr 2008 (added forward declaration of boost::swap overload) Niels Dekker +// 10 May 2008 (added swap related forward declaration) Niels Dekker // #ifndef BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP #define BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP @@ -21,6 +21,8 @@ template class optional ; template void swap ( optional& , optional& ) ; +template struct optional_swap_should_use_default_constructor ; + } // namespace boost #endif From 63f6e7f45e7cdae40d389881c82e234fa4bd4e81 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sat, 10 May 2008 14:53:51 +0000 Subject: [PATCH 10/36] Added more optional::swap tests, especially on self swap, on specializing boost::swap for optional, and on swapping optional when T is a template class. [SVN r45265] --- test/optional_test.cpp | 167 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 152 insertions(+), 15 deletions(-) diff --git a/test/optional_test.cpp b/test/optional_test.cpp index 8c6811b..a2c9df9 100644 --- a/test/optional_test.cpp +++ b/test/optional_test.cpp @@ -10,7 +10,7 @@ // fernando_cacciola@hotmail.com // // Revisions: -// 25 Apr 2008 (added more swap tests) +// 10 May 2008 (added more swap tests) // #include #include @@ -1000,6 +1000,49 @@ namespace optional_swap_test } }; + // + // Class template whose default constructor should be used by optional::swap. + // Its copy constructor should be avoided! + // + template + class template_whose_default_ctor_should_be_used : public base_class_with_forbidden_assignment + { + public: + T data; + explicit template_whose_default_ctor_should_be_used(T arg) : data(arg) { } + + template_whose_default_ctor_should_be_used() : data('\0') { } + + template_whose_default_ctor_should_be_used(const template_whose_default_ctor_should_be_used &) + { + BOOST_CHECK(!"This copy constructor should not be used while swapping!"); + throw copy_ctor_exception(); + } + }; + + // + // Class whose explicit constructor should be used by optional::swap. + // Its other constructors should be avoided! + // + class class_whose_explicit_ctor_should_be_used : public base_class_with_forbidden_assignment + { + public: + char data; + explicit class_whose_explicit_ctor_should_be_used(char arg) : data(arg) { } + + class_whose_explicit_ctor_should_be_used() + { + BOOST_CHECK(!"This default constructor should not be used while swapping!"); + throw default_ctor_exception(); + } + + class_whose_explicit_ctor_should_be_used(const class_whose_explicit_ctor_should_be_used &) + { + BOOST_CHECK(!"This copy constructor should not be used while swapping!"); + throw copy_ctor_exception(); + } + }; + void swap(class_whose_default_ctor_should_not_be_used & lhs, class_whose_default_ctor_should_not_be_used & rhs) { std::swap(lhs.data, rhs.data); @@ -1015,18 +1058,90 @@ namespace optional_swap_test std::swap(lhs.data, rhs.data); } + void swap(class_whose_explicit_ctor_should_be_used & lhs, class_whose_explicit_ctor_should_be_used & rhs) + { + std::swap(lhs.data, rhs.data); + } + + template + void swap(template_whose_default_ctor_should_be_used & lhs, template_whose_default_ctor_should_be_used & rhs) + { + std::swap(lhs.data, rhs.data); + } + + // + // optional::swap should be customized when neither the copy constructor + // nor the default constructor of T are supposed to be used when swapping, e.g., + // for the following type T = class_whose_explicit_ctor_should_be_used. + // + void swap(boost::optional & x, boost::optional & y) + { + bool hasX = x; + bool hasY = y; + + if ( !hasX && !hasY ) + return; + + if( !hasX ) + x = boost::in_place('\0'); + else if ( !hasY ) + y = boost::in_place('\0'); + + optional_swap_test::swap(*x,*y); + + if( !hasX ) + y = boost::none ; + else if( !hasY ) + x = boost::none ; + } + + } // End of namespace optional_swap_test. -namespace boost { - // - // Compile time tweaking on whether or not swap should use the default constructor: - // - template <> struct optional_swap_should_use_default_constructor< - ::optional_swap_test::class_whose_default_ctor_should_be_used> : mpl::true_ {} ; +// +// Compile time tweaking on whether or not swap should use the default constructor: +// +template <> struct boost::optional_swap_should_use_default_constructor< + optional_swap_test::class_whose_default_ctor_should_be_used> : boost::mpl::true_ {} ; - template <> struct optional_swap_should_use_default_constructor< - ::optional_swap_test::class_whose_default_ctor_should_not_be_used> : mpl::false_ {} ; +template <> struct boost::optional_swap_should_use_default_constructor< + optional_swap_test::class_whose_default_ctor_should_not_be_used> : boost::mpl::false_ {} ; + +template struct boost::optional_swap_should_use_default_constructor< + optional_swap_test::template_whose_default_ctor_should_be_used > : boost::mpl::true_ {} ; + +// +// Swap specializations: +// +template <> +void boost::swap(boost::optional & x, boost::optional & y) +{ + optional_swap_test::swap(x, y); +} + +template <> +void std::swap(optional_swap_test::class_whose_default_ctor_should_be_used & x, optional_swap_test::class_whose_default_ctor_should_be_used & y) +{ + optional_swap_test::swap(x, y); +} + +template <> +void std::swap(optional_swap_test::class_whose_default_ctor_should_not_be_used & x, optional_swap_test::class_whose_default_ctor_should_not_be_used & y) +{ + optional_swap_test::swap(x, y); +} + +template <> +void std::swap(optional_swap_test::class_without_default_ctor & x, optional_swap_test::class_without_default_ctor & y) +{ + optional_swap_test::swap(x, y); +} + +template <> +void std::swap(optional_swap_test::class_whose_explicit_ctor_should_be_used & x, optional_swap_test::class_whose_explicit_ctor_should_be_used & y) +{ + optional_swap_test::swap(x, y); } @@ -1044,16 +1159,25 @@ bool test_swap_function( T const* ) optional obj1; optional obj2('a'); - // Test if obj1 and obj2 are properly initialized. + // Self-swap should not have any effect. + swap(obj1, obj1); + swap(obj2, obj2); BOOST_CHECK(!obj1); BOOST_CHECK(!!obj2 && obj2->data == 'a'); - // Call non-member swap + // Call non-member swap. swap(obj1, obj2); - // Test if obj1 and obj2 are really swapped + // Test if obj1 and obj2 are really swapped. BOOST_CHECK(!!obj1 && obj1->data == 'a'); BOOST_CHECK(!obj2); + + // Call non-member swap one more time. + swap(obj1, obj2); + + // Test if obj1 and obj2 are swapped back. + BOOST_CHECK(!obj1); + BOOST_CHECK(!!obj2 && obj2->data == 'a'); } catch(const std::exception &) { @@ -1077,16 +1201,25 @@ bool test_swap_member_function( T const* ) optional obj1; optional obj2('a'); - // Test if obj1 and obj2 are properly initialized. + // Self-swap should not have any effect. + obj1.swap(obj1); + obj2.swap(obj2); BOOST_CHECK(!obj1); BOOST_CHECK(!!obj2 && obj2->data == 'a'); - // Call member swap + // Call member swap. obj1.swap(obj2); - // Test if obj1 and obj2 are really swapped + // Test if obj1 and obj2 are really swapped. BOOST_CHECK(!!obj1 && obj1->data == 'a'); BOOST_CHECK(!obj2); + + // Call member swap one more time. + obj1.swap(obj2); + + // Test if obj1 and obj2 are swapped back. + BOOST_CHECK(!obj1); + BOOST_CHECK(!!obj2 && obj2->data == 'a'); } catch(const std::exception &) { @@ -1106,9 +1239,13 @@ void test_swap_tweaking() BOOST_CHECK( test_swap_function( ARG(optional_swap_test::class_without_default_ctor) ) ); BOOST_CHECK( test_swap_function( ARG(optional_swap_test::class_whose_default_ctor_should_be_used) ) ); BOOST_CHECK( test_swap_function( ARG(optional_swap_test::class_whose_default_ctor_should_not_be_used) ) ); + BOOST_CHECK( test_swap_function( ARG(optional_swap_test::class_whose_explicit_ctor_should_be_used) ) ); + BOOST_CHECK( test_swap_function( ARG(optional_swap_test::template_whose_default_ctor_should_be_used) ) ); BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::class_without_default_ctor) ) ); BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::class_whose_default_ctor_should_be_used) ) ); BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::class_whose_default_ctor_should_not_be_used) ) ); + BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::class_whose_explicit_ctor_should_be_used) ) ); + BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::template_whose_default_ctor_should_be_used) ) ); } int test_main( int, char* [] ) From 3ebabcb2d8dcb410544aa6d67b3d2011c5163c6f Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Mon, 12 May 2008 13:29:52 +0000 Subject: [PATCH 11/36] Fixed syntax of optional_swap_should_use_default_constructor and swap template specializations that I added 2 days ago (changeset [45265]). Was accepted by MSVC, but rejected by other compilers. [SVN r45295] --- test/optional_test.cpp | 49 +++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/test/optional_test.cpp b/test/optional_test.cpp index a2c9df9..e841194 100644 --- a/test/optional_test.cpp +++ b/test/optional_test.cpp @@ -10,7 +10,7 @@ // fernando_cacciola@hotmail.com // // Revisions: -// 10 May 2008 (added more swap tests) +// 12 May 2008 (added more swap tests) // #include #include @@ -1099,50 +1099,65 @@ namespace optional_swap_test } // End of namespace optional_swap_test. +namespace boost { + // // Compile time tweaking on whether or not swap should use the default constructor: // -template <> struct boost::optional_swap_should_use_default_constructor< - optional_swap_test::class_whose_default_ctor_should_be_used> : boost::mpl::true_ {} ; -template <> struct boost::optional_swap_should_use_default_constructor< - optional_swap_test::class_whose_default_ctor_should_not_be_used> : boost::mpl::false_ {} ; +template <> struct optional_swap_should_use_default_constructor< + optional_swap_test::class_whose_default_ctor_should_be_used> : mpl::true_ {} ; + +template <> struct optional_swap_should_use_default_constructor< + optional_swap_test::class_whose_default_ctor_should_not_be_used> : mpl::false_ {} ; + +template struct optional_swap_should_use_default_constructor< + optional_swap_test::template_whose_default_ctor_should_be_used > : mpl::true_ {} ; -template struct boost::optional_swap_should_use_default_constructor< - optional_swap_test::template_whose_default_ctor_should_be_used > : boost::mpl::true_ {} ; // -// Swap specializations: +// Specialization of boost::swap: // template <> -void boost::swap(boost::optional & x, boost::optional & y) +void swap(optional & x, optional & y) +{ + optional_swap_test::swap(x, y); +} + +} // namespace boost + + +namespace std { + +// +// Specializations of std::swap: +// + +template <> +void swap(optional_swap_test::class_whose_default_ctor_should_be_used & x, optional_swap_test::class_whose_default_ctor_should_be_used & y) { optional_swap_test::swap(x, y); } template <> -void std::swap(optional_swap_test::class_whose_default_ctor_should_be_used & x, optional_swap_test::class_whose_default_ctor_should_be_used & y) +void swap(optional_swap_test::class_whose_default_ctor_should_not_be_used & x, optional_swap_test::class_whose_default_ctor_should_not_be_used & y) { optional_swap_test::swap(x, y); } template <> -void std::swap(optional_swap_test::class_whose_default_ctor_should_not_be_used & x, optional_swap_test::class_whose_default_ctor_should_not_be_used & y) +void swap(optional_swap_test::class_without_default_ctor & x, optional_swap_test::class_without_default_ctor & y) { optional_swap_test::swap(x, y); } template <> -void std::swap(optional_swap_test::class_without_default_ctor & x, optional_swap_test::class_without_default_ctor & y) +void swap(optional_swap_test::class_whose_explicit_ctor_should_be_used & x, optional_swap_test::class_whose_explicit_ctor_should_be_used & y) { optional_swap_test::swap(x, y); } -template <> -void std::swap(optional_swap_test::class_whose_explicit_ctor_should_be_used & x, optional_swap_test::class_whose_explicit_ctor_should_be_used & y) -{ - optional_swap_test::swap(x, y); -} +} // namespace std // From 2af3ec341bdc7075242731a02f4b731383b7f2b5 Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Sat, 1 Nov 2008 13:15:41 +0000 Subject: [PATCH 12/36] Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor [SVN r49510] --- CMakeLists.txt | 22 ++++++++++++++++++++++ test/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c26d3b9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +#---------------------------------------------------------------------------- +# This file was automatically generated from the original CMakeLists.txt file +# Add a variable to hold the headers for the library +set (lib_headers + optional.hpp + optional +) + +# Add a library target to the build system +boost_library_project( + optional + # SRCDIRS + TESTDIRS test + HEADERS ${lib_headers} + # DOCDIRS + # DESCRIPTION + MODULARIZED + # AUTHORS + # MAINTAINERS +) + + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..ef4e3bc --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,13 @@ +boost_test_run(optional_test) +boost_test_run(optional_test_tie) +boost_test_run(optional_test_ref) +boost_test_run(optional_test_inplace) +boost_test_run(optional_test_io) +boost_test_compile_fail(optional_test_fail1) +boost_test_compile_fail(optional_test_fail3a) +boost_test_compile_fail(optional_test_fail3b) +boost_test_compile_fail(optional_test_ref_fail1) +boost_test_compile_fail(optional_test_ref_fail3) +boost_test_compile_fail(optional_test_ref_fail4) +boost_test_compile_fail(optional_test_inplace_fail) +boost_test_compile_fail(optional_test_inplace_fail2) From e7d7b014d2db71085436149a6edfbdc25c26d636 Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Fri, 7 Nov 2008 17:02:56 +0000 Subject: [PATCH 13/36] Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use. [SVN r49627] --- test/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ef4e3bc..13439c9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,6 @@ +boost_additional_test_dependencies(optional BOOST_DEPENDS test tuple) + + boost_test_run(optional_test) boost_test_run(optional_test_tie) boost_test_run(optional_test_ref) From 9f655c69329ceb1a3ece0b779dc0e31ac1f4f4fb Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Fri, 7 Nov 2008 17:05:27 +0000 Subject: [PATCH 14/36] Updating dependency information for modularized libraries. [SVN r49628] --- module.cmake | 1 + 1 file changed, 1 insertion(+) create mode 100644 module.cmake diff --git a/module.cmake b/module.cmake new file mode 100644 index 0000000..59d630b --- /dev/null +++ b/module.cmake @@ -0,0 +1 @@ +boost_module(optional DEPENDS utility) \ No newline at end of file From fd38be16364f0a28ec2bff39ce37424bec7fb453 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 28 Jan 2009 09:14:56 +0000 Subject: [PATCH 15/36] Fix an incorrectly escaped right arrow. [SVN r50839] --- doc/special_cases.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/special_cases.qbk b/doc/special_cases.qbk index be65f6b..a054474 100644 --- a/doc/special_cases.qbk +++ b/doc/special_cases.qbk @@ -205,7 +205,7 @@ A wrapper class aware of this can use it as: { // Wrapped object constructed in-place via a TypedInPlaceFactory. // No temporary created. - W ( TypedInPlaceFactory2(123,"hello")) ; } The factories are divided in two groups: From 20c9fc8ebec9303bced969d5e8927fbd9c34ffe2 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 12 Feb 2009 14:01:48 +0000 Subject: [PATCH 16/36] Fix the optional and numeric/conversion docs so they generate valid Docbook XML that can be transformed into PDF's. Regenerated HTML versions of the docs. [SVN r51218] --- doc/Jamfile.v2 | 4 + .../a_note_about_optional_bool_.html | 24 ++-- doc/html/boost_optional/acknowledgments.html | 23 ++-- .../dependencies_and_portability.html | 16 ++- .../boost_optional/detailed_semantics.html | 106 +++++++----------- doc/html/boost_optional/development.html | 26 ++--- doc/html/boost_optional/examples.html | 36 +++--- .../exception_safety_guarantees.html | 28 ++--- .../boost_optional/implementation_notes.html | 15 ++- .../boost_optional/in_place_factories.html | 38 +++---- .../boost_optional/optional_references.html | 15 ++- ...for_assignment_of_optional_references.html | 35 +++--- doc/html/boost_optional/synopsis.html | 97 ++++++++-------- .../boost_optional/type_requirements.html | 15 ++- doc/html/index.html | 28 ++--- doc/implementation_notes.qbk | 2 - doc/reference.qbk | 6 +- doc/special_cases.qbk | 6 +- 18 files changed, 223 insertions(+), 297 deletions(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index abdaf20..d6a7076 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -12,6 +12,8 @@ import quickbook ; +path-constant images : html ; + xml optional : optional.qbk @@ -26,5 +28,7 @@ boostbook standalone toc.max.depth=2 toc.section.depth=2 chunk.section.depth=1 + pdf:img.src.path=$(images)/ ; + diff --git a/doc/html/boost_optional/a_note_about_optional_bool_.html b/doc/html/boost_optional/a_note_about_optional_bool_.html index 5191d1d..9ef5f05 100644 --- a/doc/html/boost_optional/a_note_about_optional_bool_.html +++ b/doc/html/boost_optional/a_note_about_optional_bool_.html @@ -1,23 +1,21 @@ -A note about - optional<bool> +A note about optional<bool> - - + + - + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -26,8 +24,7 @@

    @@ -36,7 +33,7 @@

    First, it is functionally similar to a tristate boolean (false,maybe,true) - —such as boost::tribool— + —such as boost::tribool— except that in a tristate boolean, the maybe state represents a valid value, unlike the corresponding state of an uninitialized optional<bool>. It @@ -52,8 +49,7 @@ lead to subtle errors due to the implicit bool conversion:

    -
    -void foo ( bool v ) ;
    +
    void foo ( bool v ) ;
     void bar()
     {
         optional<bool> v = try();
    diff --git a/doc/html/boost_optional/acknowledgments.html b/doc/html/boost_optional/acknowledgments.html
    index 09e3c71..d58d175 100644
    --- a/doc/html/boost_optional/acknowledgments.html
    +++ b/doc/html/boost_optional/acknowledgments.html
    @@ -3,19 +3,18 @@
     
     Acknowledgments
     
    -
    -
    +
    +
     
    -
    +
     
     
     
    -
    +
    -
    -
    +
    +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,11 +23,11 @@

    - - Pre-formal + + Pre-formal review

      @@ -66,8 +65,8 @@

    - - Post-formal + + Post-formal review

      diff --git a/doc/html/boost_optional/dependencies_and_portability.html b/doc/html/boost_optional/dependencies_and_portability.html index 35ecb80..de08f43 100644 --- a/doc/html/boost_optional/dependencies_and_portability.html +++ b/doc/html/boost_optional/dependencies_and_portability.html @@ -1,11 +1,10 @@ -Dependencies - and Portability +Dependencies and Portability - - + + @@ -13,10 +12,10 @@ - + - - + +
      Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

      @@ -25,8 +24,7 @@

    diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index ef68023..731a2c8 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -3,8 +3,8 @@ Detailed Semantics - - + + @@ -12,10 +12,10 @@ - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More


    @@ -24,7 +24,7 @@

    Because T might be of reference @@ -64,8 +64,8 @@ space

    - - optional + + optional class member functions

    @@ -97,8 +97,7 @@ called.

  • -Example:
    -optional<T> def ;
    +Example:
    optional<T> def ;
     assert ( !def ) ;
     
  • @@ -134,8 +133,7 @@ The expression boost::none denotes an instance of boost::none_t that can be used as the parameter.
  • -Example:
    -#include <boost/none.hpp>
    +Example:
    #include <boost/none.hpp>
     optional<T> n(none) ;
     assert ( !n ) ;
     
    @@ -180,8 +178,7 @@ has no effect.
  • -Example:
    -T v;
    +Example:
    T v;
     optional<T> opt(v);
     assert ( *opt == v ) ;
     
    @@ -212,8 +209,7 @@ Throws: Nothing.
  • -Example:
    -T v;
    +Example:
    T v;
     T& vref = v ;
     optional<T&> opt(vref);
     assert ( *opt == v ) ;
    @@ -338,8 +334,7 @@
             has no effect.
           
  • -Example:
    -optional<T> uninit ;
    +Example:
    optional<T> uninit ;
     assert (!uninit);
     
     optional<T> uinit2 ( uninit ) ;
    @@ -387,8 +382,7 @@
             will reefer to the same object (they alias).
           
  • -Example:
    -optional<T&> uninit ;
    +Example:
    optional<T&> uninit ;
     assert (!uninit);
     
     optional<T&> uinit2 ( uninit ) ;
    @@ -454,8 +448,7 @@
             has no effect.
           
  • -Example:
    -optional<double> x(123.4);
    +Example:
    optional<double> x(123.4);
     assert ( *x == 123.4 ) ;
     
     optional<int> y(x) ;
    @@ -506,7 +499,7 @@
             constructor called by the factory throws.
           
  • -Notes: See In-Place +Notes: See In-Place Factories
  • @@ -515,8 +508,7 @@ constructor used by the factory; in that case, this constructor has no effect.
  • -Example:
    -class C { C ( char, double, std::string ) ; } ;
    +Example:
    class C { C ( char, double, std::string ) ; } ;
     
     C v('A',123.4,"hello");
     
    @@ -574,8 +566,7 @@
             copy constructor fails, *this is left properly uninitialized.
           
  • -Example:
    -T x;
    +Example:
    T x;
     optional<T> def ;
     optional<T> opt(x) ;
     
    @@ -613,12 +604,11 @@
           
  • Notes: If *this was initialized, is is rebound - to the new object. See here for - details on this behavior. + to the new object. See here + for details on this behavior.
  • -Example:
    -int a = 1 ;
    +Example:
    int a = 1 ;
     int b = 2 ;
     T& ra = a ;
     T& rb = b ;
    @@ -687,8 +677,7 @@
             copy constructor fails, *this is left properly uninitialized.
           
  • -Example:
    -T v;
    +Example:
    T v;
     optional<T> opt(v);
     optional<T> def ;
     
    @@ -721,12 +710,11 @@
           
  • Notes: If *this was initialized and so is *rhs, this - is is rebound to the new object. See here + is is rebound to the new object. See here for details on this behavior.
  • -Example:
    -int a = 1 ;
    +Example:
    int a = 1 ;
     int b = 2 ;
     T& ra = a ;
     T& rb = b ;
    @@ -800,8 +788,7 @@
             converting constructor fails, *this is left properly uninitialized.
           
  • -Example:
    -T v;
    +Example:
    T v;
     optional<T> opt0(v);
     optional<U> opt1;
     
    @@ -930,8 +917,7 @@
             BOOST_ASSERT().
           
  • -Example:
    -T v ;
    +Example:
    T v ;
     optional<T> opt ( v );
     T const& u = *opt;
     assert ( u == v ) ;
    @@ -1005,8 +991,7 @@
     Throws: Nothing.
           
  • -Example:
    -T v, z ;
    +Example:
    T v, z ;
     optional<T> def;
     T const& y = def.get_value_or(z);
     assert ( y == z ) ;
    @@ -1099,8 +1084,7 @@
             BOOST_ASSERT().
           
  • -Example:
    -T v ;
    +Example:
    T v ;
     T& vref = v ;
     optional<T&> opt ( vref );
     T const& vref2 = *opt;
    @@ -1173,8 +1157,7 @@
             so you should not hold nor delete this pointer
           
  • -Example:
    -T v;
    +Example:
    T v;
     optional<T> opt(v);
     optional<T> const copt(v);
     T* p = opt.get_ptr() ;
    @@ -1226,8 +1209,7 @@
             BOOST_ASSERT().
           
  • -Example:
    -struct X { int mdata ; } ;
    +Example:
    struct X { int mdata ; } ;
     X x ;
     optional<X> opt (x);
     opt->mdata = 2 ;
    @@ -1257,8 +1239,7 @@
     Throws: Nothing.
           
  • -Example:
    -optional<T> def ;
    +Example:
    optional<T> def ;
     assert ( def == 0 );
     optional<T> opt ( v ) ;
     assert ( opt );
    @@ -1294,8 +1275,7 @@
             in certain boolean contexts.
           
  • -Example:
    -optional<T> opt ;
    +Example:
    optional<T> opt ;
     assert ( !opt );
     *opt = some_T ;
     
    @@ -1328,8 +1308,7 @@
     Throws: Nothing.
           
  • -Example:
    -optional<T> def ;
    +Example:
    optional<T> def ;
     assert ( !def.is_initialized() );
     optional<T> opt ( v ) ;
     assert ( opt.is_initialized() );
    @@ -1340,8 +1319,8 @@
           space
         

    - - Free functions + + Free functions

    space @@ -1364,8 +1343,7 @@ of v.

  • -Example:
    -template<class T> void foo ( optional<T> const& opt ) ;
    +Example:
    template<class T> void foo ( optional<T> const& opt ) ;
     
     foo ( make_optional(1+1) ) ; // Creates an optional<int>
     
    @@ -1393,8 +1371,7 @@ of v.
  • -Example:
    -optional<double> calculate_foo()
    +Example:
    optional<double> calculate_foo()
     {
       double val = compute_foo();
       return make_optional(is_not_nan_and_finite(val),val);
    @@ -1441,8 +1418,7 @@
             instead
           
  • -Example:
    -T x(12);
    +Example:
    T x(12);
     T y(12);
     T z(21);
     optional<T> def0 ;
    @@ -1503,8 +1479,7 @@
             instead.
           
  • -Example:
    -T x(12);
    +Example:
    T x(12);
     T y(34);
     optional<T> def ;
     optional<T> optX(x);
    @@ -1674,8 +1649,7 @@
             If only one is initialized, it has the same basic guarantee as optional<T>::reset( T const& ).
           
  • -Example:
    -T x(12);
    +Example:
    T x(12);
     T y(21);
     optional<T> def0 ;
     optional<T> def1 ;
    diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html
    index 8d58d8b..1df4a70 100644
    --- a/doc/html/boost_optional/development.html
    +++ b/doc/html/boost_optional/development.html
    @@ -3,8 +3,8 @@
     
     Development
     
    -
    -
    +
    +
     
     
     
    @@ -12,10 +12,10 @@
     
     
    -
    +
    -
    -
    +
    +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,7 +24,7 @@
  • The models
    @@ -33,7 +33,7 @@

    In C++, we can declare an object (a variable) of type @@ -170,7 +170,7 @@

    Objects of type optional<T> @@ -254,7 +254,7 @@

    Since the purpose of optional is to allow us to use objects with a formal @@ -292,8 +292,8 @@ itself which are supported by a special interface.

    - - Lexically-hinted + + Lexically-hinted Value Access in the presence of possibly untitialized optional objects: The operators * and ->
    @@ -357,8 +357,8 @@ incarnated by pointers.

    - - Optional<T> + + Optional<T> as a model of OptionalPointee

    diff --git a/doc/html/boost_optional/examples.html b/doc/html/boost_optional/examples.html index 7685a73..9c8764b 100644 --- a/doc/html/boost_optional/examples.html +++ b/doc/html/boost_optional/examples.html @@ -3,8 +3,8 @@ Examples - - + + @@ -12,10 +12,10 @@ - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More


    @@ -24,7 +24,7 @@
    -
    -optional<char> get_async_input()
    +
    optional<char> get_async_input()
     {
         if ( !queue.empty() )
             return optional<char>(queue.top());
    @@ -61,12 +59,10 @@
     
    -
    -optional<string> name ;
    +
    optional<string> name ;
     if ( database.open() )
     {
         name.reset ( database.lookup(employer_name) ) ;
    @@ -84,12 +80,10 @@
     
    -
    -class figure
    +
    class figure
     {
         public:
     
    @@ -124,12 +118,10 @@
     
    -
    -class ExpensiveCtor { ... } ;
    +
    class ExpensiveCtor { ... } ;
     class Fred
     {
         Fred() : mLargeVector(10000) {}
    diff --git a/doc/html/boost_optional/exception_safety_guarantees.html b/doc/html/boost_optional/exception_safety_guarantees.html
    index 8f6504f..d863a86 100644
    --- a/doc/html/boost_optional/exception_safety_guarantees.html
    +++ b/doc/html/boost_optional/exception_safety_guarantees.html
    @@ -1,23 +1,21 @@
     
     
     
    -Exception Safety
    -    Guarantees
    +Exception Safety Guarantees
     
    -
    -
    +
    +
     
    -
    +
     
     
     
     
    -
    +
    -
    -
    +
    +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -26,12 +24,11 @@

    - Because of the current implementation (see Implementation + Because of the current implementation (see Implementation Notes), all of the assignment methods:

      @@ -75,8 +72,7 @@ know that optional's assignment and reset has the same guarantees.

      -
      -//
      +
      //
       // Case 1: Exception thrown during assignment.
       //
       T v0(123);
      @@ -116,8 +112,8 @@
       }
       

      - - Swap + + Swap

      void swap( optional<T>&, diff --git a/doc/html/boost_optional/implementation_notes.html b/doc/html/boost_optional/implementation_notes.html index c0225b3..8308c01 100644 --- a/doc/html/boost_optional/implementation_notes.html +++ b/doc/html/boost_optional/implementation_notes.html @@ -3,20 +3,19 @@ Implementation Notes - - + + - + - + - - + +
      Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More


      @@ -25,7 +24,7 @@

    optional<T> is diff --git a/doc/html/boost_optional/in_place_factories.html b/doc/html/boost_optional/in_place_factories.html index a972384..0c89689 100644 --- a/doc/html/boost_optional/in_place_factories.html +++ b/doc/html/boost_optional/in_place_factories.html @@ -3,21 +3,19 @@ In-Place Factories - - + + - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More


    @@ -26,7 +24,7 @@

    One of the typical problems with wrappers and containers is that their interfaces @@ -36,8 +34,7 @@ but also requires the existence of a fully constructed object, often temporary, just to follow the copy from:

    -
    -struct X
    +
    struct X
     {
         X ( int, std:::string ) ;
     } ;
    @@ -62,8 +59,7 @@
           object right in the container's storage. In this scheme, the user only needs
           to supply the arguments to the constructor to use in the wrapped object construction.
         

    -
    -class W
    +
    class W
     {
         X wrapped_ ;
     
    @@ -96,8 +92,7 @@
     

    For example, one member of this family looks like:

    -
    -template<class T,class A0, class A1>
    +
    template<class T,class A0, class A1>
     class TypedInPlaceFactory2
     {
         A0 m_a0 ; A1 m_a1 ;
    @@ -112,8 +107,7 @@
     

    A wrapper class aware of this can use it as:

    -
    -class W
    +
    class W
     {
         X wrapped_ ;
     
    @@ -127,7 +121,7 @@
     {
         // Wrapped object constructed in-place via a TypedInPlaceFactory.
         // No temporary created.
    -    W ( TypedInPlaceFactory2<X,int,std::string&rt(123,"hello")) ;
    +    W ( TypedInPlaceFactory2<X,int,std::string>(123,"hello")) ;
     }
     

    @@ -152,8 +146,7 @@ This library provides an overloaded set of helper template functions to construct these factories without requiring unnecessary template parameters:

    -
    -template<class A0,...,class AN>
    +
    template<class A0,...,class AN>
     InPlaceFactoryN <A0,...,AN> in_place ( A0 const& a0, ..., AN const& aN) ;
     
     template<class T,class A0,...,class AN>
    @@ -162,8 +155,7 @@
     

    In-place factories can be used generically by the wrapper and user as follows:

    -
    -class W
    +
    class W
     {
         X wrapped_ ;
     
    diff --git a/doc/html/boost_optional/optional_references.html b/doc/html/boost_optional/optional_references.html
    index 1222a42..90a5144 100644
    --- a/doc/html/boost_optional/optional_references.html
    +++ b/doc/html/boost_optional/optional_references.html
    @@ -3,20 +3,19 @@
     
     Optional references
     
    -
    -
    +
    +
     
     
    -
    +
     
     
     
    -
    +
    -
    -
    +
    +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -25,7 +24,7 @@

    This library allows the template parameter T diff --git a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html index 5b894aa..3b11e4f 100644 --- a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html +++ b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html @@ -1,11 +1,10 @@ -Rebinding - semantics for assignment of optional references +Rebinding semantics for assignment of optional references - - + + @@ -13,10 +12,10 @@ - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More


    @@ -25,8 +24,7 @@

    @@ -34,8 +32,7 @@ the effect is to bind (for the first time) to the object. Clearly, there is no other choice.

    -
    -int x = 1 ;
    +
    int x = 1 ;
     int& rx = x ;
     optional<int&> ora ;
     optional<int&> orb(x) ;
    @@ -47,8 +44,7 @@
           If you assign to a bare C++ reference, the assignment is forwarded to the referenced
           object; it's value changes but the reference is never rebound.
         

    -
    -int a = 1 ;
    +
    int a = 1 ;
     int& ra = a ;
     int b = 2 ;
     int& rb = b ;
    @@ -62,8 +58,7 @@
           the effect is to rebind to the new object
           instead of assigning the referee. This is unlike bare C++ references.
         

    -
    -int a = 1 ;
    +
    int a = 1 ;
     int b = 2 ;
     int& ra = a ;
     int& rb = b ;
    @@ -75,8 +70,8 @@
     assert(b==3); 
     

    - - Rationale + + Rationale

    Rebinding semantics for the assignment of initialized @@ -95,8 +90,7 @@ forwarding assignment to the referenced object (thus changing the referenced object value but not rebinding), and consider the following code:

    -
    -optional<int&> a = get();
    +
    optional<int&> a = get();
     int x = 1 ;
     int& rx = x ;
     optional<int&> b(rx);
    @@ -134,8 +128,7 @@
           for the first time is OK while rebinding is not which is IMO very unlikely.
           In such scenario, you can assign the value itself directly, as in:
         

    -
    -assert(!!opt);
    +
    assert(!!opt);
     *opt=value;
     
    diff --git a/doc/html/boost_optional/synopsis.html b/doc/html/boost_optional/synopsis.html index c128fc6..3abdcd3 100644 --- a/doc/html/boost_optional/synopsis.html +++ b/doc/html/boost_optional/synopsis.html @@ -3,8 +3,8 @@ Synopsis - - + + @@ -12,10 +12,10 @@ - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -24,10 +24,9 @@
    -
    -namespace boost {
    +
    namespace boost {
     
     template<class T>
     class optional
    @@ -36,101 +35,101 @@
     
         // (If T is of reference type, the parameters and results by reference are by value)
     
    -    optional () ; R
    +    optional () ; R
     
    -    optional ( none_t ) ; R
    +    optional ( none_t ) ; R
     
    -    optional ( T const& v ) ; R
    +    optional ( T const& v ) ; R
     
         // [new in 1.34]
    -    optional ( bool condition, T const& v ) ; R 
    +    optional ( bool condition, T const& v ) ; R 
     
    -    optional ( optional const& rhs ) ; R
    +    optional ( optional const& rhs ) ; R
     
    -    template<class U> explicit optional ( optional<U> const& rhs ) ; R
    +    template<class U> explicit optional ( optional<U> const& rhs ) ; R
     
    -    template<class InPlaceFactory> explicit optional ( InPlaceFactory const& f ) ; R
    +    template<class InPlaceFactory> explicit optional ( InPlaceFactory const& f ) ; R
     
    -    template<class TypedInPlaceFactory> explicit optional ( TypedInPlaceFactory const& f ) ; R
    +    template<class TypedInPlaceFactory> explicit optional ( TypedInPlaceFactory const& f ) ; R
     
         optional& operator = ( none_t ) ; 
     
    -    optional& operator = ( T const& v ) ; R
    +    optional& operator = ( T const& v ) ; R
     
    -    optional& operator = ( optional const& rhs ) ; R
    +    optional& operator = ( optional const& rhs ) ; R
     
    -    template<class U> optional& operator = ( optional<U> const& rhs ) ; R
    +    template<class U> optional& operator = ( optional<U> const& rhs ) ; R
     
         template<class InPlaceFactory> optional& operator = ( InPlaceFactory const& f ) ; 
     
         template<class TypedInPlaceFactory> optional& operator = ( TypedInPlaceFactory const& f ) ; 
     
    -    T const& get() const ; R
    -    T&       get() ; R
    +    T const& get() const ; R
    +    T&       get() ; R
     
         // [new in 1.34]
    -    T const& get_value_or( T const& default ) const ; R 
    +    T const& get_value_or( T const& default ) const ; R 
     
    -    T const* operator ->() const ; R
    -    T*       operator ->() ; R
    +    T const* operator ->() const ; R
    +    T*       operator ->() ; R
     
    -    T const& operator *() const ; R
    -    T&       operator *() ; R
    +    T const& operator *() const ; R
    +    T&       operator *() ; R
     
    -    T const* get_ptr() const ; R
    -    T*       get_ptr() ; R
    +    T const* get_ptr() const ; R
    +    T*       get_ptr() ; R
     
    -    operator unspecified-bool-type() const ; R
    +    operator unspecified-bool-type() const ; R
     
    -    bool operator!() const ; R
    +    bool operator!() const ; R
     
         // deprecated methods
     
         // (deprecated)
    -    void reset() ; R
    +    void reset() ; R
     
         // (deprecated)
    -    void reset ( T const& ) ; R
    +    void reset ( T const& ) ; R
     
         // (deprecated)
    -    bool is_initialized() const ; R
    +    bool is_initialized() const ; R
     
     };
     
    -template<class T> inline bool operator == ( optional<T> const& x, optional<T> const& y ) ; R
    +template<class T> inline bool operator == ( optional<T> const& x, optional<T> const& y ) ; R
     
    -template<class T> inline bool operator != ( optional<T> const& x, optional<T> const& y ) ; R
    +template<class T> inline bool operator != ( optional<T> const& x, optional<T> const& y ) ; R
     
    -template<class T> inline bool operator <  ( optional<T> const& x, optional<T> const& y ) ; R
    +template<class T> inline bool operator <  ( optional<T> const& x, optional<T> const& y ) ; R
     
    -template<class T> inline bool operator >  ( optional<T> const& x, optional<T> const& y ) ; R
    +template<class T> inline bool operator >  ( optional<T> const& x, optional<T> const& y ) ; R
     
    -template<class T> inline bool operator <= ( optional<T> const& x, optional<T> const& y ) ; R
    +template<class T> inline bool operator <= ( optional<T> const& x, optional<T> const& y ) ; R
     
    -template<class T> inline bool operator >= ( optional<T> const& x, optional<T> const& y ) ; R
    +template<class T> inline bool operator >= ( optional<T> const& x, optional<T> const& y ) ; R
     
     // [new in 1.34]
    -template<class T> inline optional<T> make_optional ( T const& v ) ; R
    +template<class T> inline optional<T> make_optional ( T const& v ) ; R
     
     // [new in 1.34]
    -template<class T> inline optional<T> make_optional ( bool condition, T const& v ) ; R
    +template<class T> inline optional<T> make_optional ( bool condition, T const& v ) ; R
     
     // [new in 1.34]
    -template<class T> inline T const& get_optional_value_or ( optional<T> const& opt, T const& default ) ; R 
    +template<class T> inline T const& get_optional_value_or ( optional<T> const& opt, T const& default ) ; R 
     
    -template<class T> inline T const& get ( optional<T> const& opt ) ; R
    +template<class T> inline T const& get ( optional<T> const& opt ) ; R
     
    -template<class T> inline T& get ( optional<T> & opt ) ; R
    +template<class T> inline T& get ( optional<T> & opt ) ; R
     
    -template<class T> inline T const* get ( optional<T> const* opt ) ; R
    +template<class T> inline T const* get ( optional<T> const* opt ) ; R
     
    -template<class T> inline T* get ( optional<T>* opt ) ; R
    +template<class T> inline T* get ( optional<T>* opt ) ; R
     
    -template<class T> inline T const* get_pointer ( optional<T> const& opt ) ; R
    +template<class T> inline T const* get_pointer ( optional<T> const& opt ) ; R
     
    -template<class T> inline T* get_pointer ( optional<T> & opt ) ; R
    +template<class T> inline T* get_pointer ( optional<T> & opt ) ; R
     
    -template<class T> inline void swap( optional<T>& x, optional<T>& y ) ; R
    +template<class T> inline void swap( optional<T>& x, optional<T>& y ) ; R
     
     } // namespace boost
     
    diff --git a/doc/html/boost_optional/type_requirements.html b/doc/html/boost_optional/type_requirements.html index 0676bf1..efc6caa 100644 --- a/doc/html/boost_optional/type_requirements.html +++ b/doc/html/boost_optional/type_requirements.html @@ -3,20 +3,19 @@ Type requirements - - + + - + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More

    @@ -25,7 +24,7 @@

    In general, T must be Copy Constructible and diff --git a/doc/html/index.html b/doc/html/index.html index 24277e1..6f2be2c 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,17 +3,17 @@ Chapter 1. Boost.Optional - - + + - + - - + +
    Boost C++ LibrariesHomeHome LibrariesPeopleFAQPeopleFAQ More


    @@ -27,7 +27,7 @@
    -

    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    @@ -73,7 +73,7 @@

    Consider these functions which should return a value but which might not have @@ -142,16 +142,14 @@ the function would conceptually return. For example, the last two functions could have the following interface:

    -
    -std::pair<char,bool> get_async_input();
    +
    std::pair<char,bool> get_async_input();
     std::pair<point,bool> polygon::get_any_point_effectively_inside();
     

    These functions use a consistent interface for dealing with possibly inexistent results:

    -
    -std::pair<point,bool> p = poly.get_any_point_effectively_inside();
    +
    std::pair<point,bool> p = poly.get_any_point_effectively_inside();
     if ( p.second )
         flood_fill(p.first);
     
    @@ -166,15 +164,9 @@

    -

    -

    -

    -

    -

    -

    - +

    Last revised: February 12, 2008 at 22:47:14 GMT

    Last revised: February 09, 2009 at 11:55:08 GMT


    diff --git a/doc/implementation_notes.qbk b/doc/implementation_notes.qbk index 519b3ee..53e6138 100644 --- a/doc/implementation_notes.qbk +++ b/doc/implementation_notes.qbk @@ -10,8 +10,6 @@ -[#optional_implementation_notes] - [section Implementation Notes] `optional` is currently implemented using a custom aligned storage facility diff --git a/doc/reference.qbk b/doc/reference.qbk index c50b61a..ea41210 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -331,7 +331,7 @@ factory. * [*Postconditions: ] `*this` is [_initialized] and its value is ['directly given] from the factory `f` (i.e., the value [_is not copied]). * [*Throws:] Whatever the `T` constructor called by the factory throws. -* [*Notes:] See [link optional_in_place_factories In-Place Factories] +* [*Notes:] See [link boost_optional.in_place_factories In-Place Factories] * [*Exception Safety:] Exceptions can only be thrown during the call to the `T` constructor used by the factory; in that case, this constructor has no effect. @@ -385,7 +385,7 @@ __SPACE__ * [*Postconditions: ] `*this` is initialized and it references the same object referenced by `rhs`. * [*Notes:] If `*this` was initialized, is is ['rebound] to the new object. -See [link optional_refassign here] for details on this behavior. +See [link boost_optional.rebinding_semantics_for_assignment_of_optional_references here] for details on this behavior. * [*Example:] `` int a = 1 ; @@ -444,7 +444,7 @@ __SPACE__ references the same object referenced by `*rhs`; otherwise, `*this` is uninitialized (and references no object). * [*Notes:] If `*this` was initialized and so is *rhs, this is is ['rebound] to -the new object. See [link optional_refassign here] for details on this behavior. +the new object. See [link boost_optional.rebinding_semantics_for_assignment_of_optional_references here] for details on this behavior. * [*Example:] `` int a = 1 ; diff --git a/doc/special_cases.qbk b/doc/special_cases.qbk index a054474..07f1039 100644 --- a/doc/special_cases.qbk +++ b/doc/special_cases.qbk @@ -23,8 +23,6 @@ rather than the reference itself. [endsect] -[#optional_refassign] - [section Rebinding semantics for assignment of optional references] If you assign to an ['uninitialized ] `optional` the effect is to bind (for @@ -112,8 +110,6 @@ In such scenario, you can assign the value itself directly, as in: [endsect] -[#optional_in_place_factories] - [section In-Place Factories] One of the typical problems with wrappers and containers is that their @@ -288,7 +284,7 @@ instead, it won't compile). [section Exception Safety Guarantees] -Because of the current implementation (see [link optional_implementation_notes Implementation Notes]), all of the assignment methods: +Because of the current implementation (see [link boost_optional.implementation_notes Implementation Notes]), all of the assignment methods: * `optional::operator= ( optional const& )` * `optional::operator= ( T const& )` From 361943e0330111780c3ef6afec6add7dac4df943 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 17 Feb 2009 10:05:58 +0000 Subject: [PATCH 17/36] Add PDF generation options to fix external links to point to the web site. Added a few more Boostbook based libs that were missed first time around. Fixed PDF naming issues. [SVN r51284] --- doc/Jamfile.v2 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index d6a7076..eeb464c 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -29,6 +29,7 @@ boostbook standalone toc.section.depth=2 chunk.section.depth=1 pdf:img.src.path=$(images)/ + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/libs/optional/doc/html ; From 2772bfc08d02a001509cde212a002e52d88eeb35 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Wed, 8 Apr 2009 12:09:58 +0000 Subject: [PATCH 18/36] optional docs in cmakeland [SVN r52251] --- CMakeLists.txt | 2 +- doc/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 doc/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index c26d3b9..1ebcceb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ boost_library_project( # SRCDIRS TESTDIRS test HEADERS ${lib_headers} - # DOCDIRS + DOCDIRS doc # DESCRIPTION MODULARIZED # AUTHORS diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..fc5ed7c --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,2 @@ +boost_add_documentation(optional.qbk) + From fea89e84f37b3a137ba505a5207ed7ba9486dd18 Mon Sep 17 00:00:00 2001 From: Jeremiah Willcock Date: Wed, 20 May 2009 19:19:00 +0000 Subject: [PATCH 19/36] Fixed most tab and min/max issues from trunk inspection report [SVN r53141] --- test/optional_test_ref.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/optional_test_ref.cpp b/test/optional_test_ref.cpp index 08ee87e..c01b08e 100644 --- a/test/optional_test_ref.cpp +++ b/test/optional_test_ref.cpp @@ -342,14 +342,14 @@ void test_binding() int i = 0 ; optional ori1 = i ; BOOST_CHECK( &(*ori1) == &i ) ; - + optional ori2(i) ; BOOST_CHECK( &(*ori2) == &i ) ; - + int const ci = 0 ; optional orci1 = ci ; BOOST_CHECK( &(*orci1) == &ci ) ; - + optional orci2(ci) ; BOOST_CHECK( &(*orci2) == &ci ) ; } @@ -360,7 +360,7 @@ int test_main( int, char* [] ) { test_with_class_type(); test_with_builtin_types(); - test_binding(); + test_binding(); } catch ( ... ) { From 8682f2bbaae15bfac132f8f41128d7cf9191be0e Mon Sep 17 00:00:00 2001 From: Gennadiy Rozental Date: Sat, 6 Jun 2009 09:42:41 +0000 Subject: [PATCH 20/36] avoid C style casts [SVN r53671] --- include/boost/none.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/none.hpp b/include/boost/none.hpp index bd342da..e9fc062 100644 --- a/include/boost/none.hpp +++ b/include/boost/none.hpp @@ -20,7 +20,7 @@ namespace boost { -none_t const none = ((none_t)0) ; +none_t const none = (static_cast(0)) ; } // namespace boost From 4e628ed4a6ce62e273bc7ccefb7158b81432ec88 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sun, 26 Jul 2009 00:49:56 +0000 Subject: [PATCH 21/36] Copyrights on CMakeLists.txt to keep them from clogging up the inspect reports. This is essentially the same commit as r55095 on the release branch. [SVN r55159] --- CMakeLists.txt | 6 ++++++ test/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ebcceb..950be6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# #---------------------------------------------------------------------------- # This file was automatically generated from the original CMakeLists.txt file # Add a variable to hold the headers for the library diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 13439c9..e95a3fe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# boost_additional_test_dependencies(optional BOOST_DEPENDS test tuple) From 066dd6f3458aff2d0313b0a23da08c32fc97a1ed Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 17 Oct 2009 02:07:38 +0000 Subject: [PATCH 22/36] rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back [SVN r56942] --- CMakeLists.txt | 28 ---------------------------- doc/CMakeLists.txt | 2 -- module.cmake | 1 - test/CMakeLists.txt | 22 ---------------------- 4 files changed, 53 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 doc/CMakeLists.txt delete mode 100644 module.cmake delete mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 950be6f..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -#---------------------------------------------------------------------------- -# This file was automatically generated from the original CMakeLists.txt file -# Add a variable to hold the headers for the library -set (lib_headers - optional.hpp - optional -) - -# Add a library target to the build system -boost_library_project( - optional - # SRCDIRS - TESTDIRS test - HEADERS ${lib_headers} - DOCDIRS doc - # DESCRIPTION - MODULARIZED - # AUTHORS - # MAINTAINERS -) - - diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt deleted file mode 100644 index fc5ed7c..0000000 --- a/doc/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -boost_add_documentation(optional.qbk) - diff --git a/module.cmake b/module.cmake deleted file mode 100644 index 59d630b..0000000 --- a/module.cmake +++ /dev/null @@ -1 +0,0 @@ -boost_module(optional DEPENDS utility) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index e95a3fe..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -boost_additional_test_dependencies(optional BOOST_DEPENDS test tuple) - - -boost_test_run(optional_test) -boost_test_run(optional_test_tie) -boost_test_run(optional_test_ref) -boost_test_run(optional_test_inplace) -boost_test_run(optional_test_io) -boost_test_compile_fail(optional_test_fail1) -boost_test_compile_fail(optional_test_fail3a) -boost_test_compile_fail(optional_test_fail3b) -boost_test_compile_fail(optional_test_ref_fail1) -boost_test_compile_fail(optional_test_ref_fail3) -boost_test_compile_fail(optional_test_ref_fail4) -boost_test_compile_fail(optional_test_inplace_fail) -boost_test_compile_fail(optional_test_inplace_fail2) From a63dbe0f146fa09c50262964331b97cf9c2d34de Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 20 Nov 2009 10:26:23 +0000 Subject: [PATCH 23/36] Rebuild optional docs. [SVN r57812] --- .../a_note_about_optional_bool_.html | 4 +- doc/html/boost_optional/acknowledgments.html | 44 +-- .../dependencies_and_portability.html | 4 +- .../boost_optional/detailed_semantics.html | 342 +++++++++--------- doc/html/boost_optional/development.html | 70 ++-- doc/html/boost_optional/examples.html | 12 +- .../exception_safety_guarantees.html | 26 +- .../boost_optional/implementation_notes.html | 4 +- .../boost_optional/in_place_factories.html | 10 +- .../boost_optional/optional_references.html | 22 +- ...for_assignment_of_optional_references.html | 6 +- doc/html/boost_optional/synopsis.html | 4 +- .../boost_optional/type_requirements.html | 4 +- doc/html/index.html | 20 +- 14 files changed, 286 insertions(+), 286 deletions(-) diff --git a/doc/html/boost_optional/a_note_about_optional_bool_.html b/doc/html/boost_optional/a_note_about_optional_bool_.html index 9ef5f05..896994e 100644 --- a/doc/html/boost_optional/a_note_about_optional_bool_.html +++ b/doc/html/boost_optional/a_note_about_optional_bool_.html @@ -3,7 +3,7 @@ A note about optional<bool> - + @@ -22,7 +22,7 @@
    PrevUpHomeNext
    -
    +

    A note about optional<bool> diff --git a/doc/html/boost_optional/acknowledgments.html b/doc/html/boost_optional/acknowledgments.html index d58d175..bd09f61 100644 --- a/doc/html/boost_optional/acknowledgments.html +++ b/doc/html/boost_optional/acknowledgments.html @@ -3,7 +3,7 @@ Acknowledgments - + @@ -21,89 +21,89 @@
    PrevUpHome
    -
    +

    - + Pre-formal review

    -
      -
    • +
        +
      • Peter Dimov suggested the name 'optional', and was the first to point out the need for aligned storage.
      • -
      • +
      • Douglas Gregor developed 'type_with_alignment', and later Eric Friedman coded 'aligned_storage', which are the core of the optional class implementation.
      • -
      • +
      • Andrei Alexandrescu and Brian Parker also worked with aligned storage techniques and their work influenced the current implementation.
      • -
      • +
      • Gennadiy Rozental made extensive and important comments which shaped the design.
      • -
      • +
      • Vesa Karvonen and Douglas Gregor made quite useful comparisons between optional, variant and any; and made other relevant comments.
      • -
      • +
      • Douglas Gregor and Peter Dimov commented on comparisons and evaluation in boolean contexts.
      • -
      • +
      • Eric Friedman helped understand the issues involved with aligned storage, move/copy operations and exception safety.
      • -
      • +
      • Many others have participated with useful comments: Aleksey Gurotov, Kevlin Henney, David Abrahams, and others I can't recall.

      - + Post-formal review

      -
        -
      • +
          +
        • William Kempf carefully considered the originally proposed interface and suggested the new interface which is currently used. He also started and fueled the discussion about the analogy optional<>/smart pointer and about relational operators.
        • -
        • +
        • Peter Dimov, Joel de Guzman, David Abrahams, Tanton Gibbs and Ian Hanson focused on the relational semantics of optional (originally undefined); concluding with the fact that the pointer-like interface doesn't make it a pointer so it shall have deep relational operators.
        • -
        • +
        • Augustus Saunders also explored the different relational semantics between optional<> and a pointer and developed the OptionalPointee concept as an aid against potential conflicts on generic code.
        • -
        • +
        • Joel de Guzman noticed that optional<> can be seen as an API on top of variant<T,nil_t>.
        • -
        • +
        • Dave Gomboc explained the meaning and usage of the Haskell analog to optional<>: the Maybe type constructor (analogy originally pointed out by David Sankel).
        • -
        • +
        • Other comments were posted by Vincent Finn, Anthony Williams, Ed Brey, Rob Stewart, and others.
        • -
        • +
        • Joel de Guzman made the case for the support of references and helped with the proper semantics.
        • -
        • +
        • Mat Marcus shown the virtues of a value-oriented interface, influencing the current design, and contributed the idea of "none".
        • diff --git a/doc/html/boost_optional/dependencies_and_portability.html b/doc/html/boost_optional/dependencies_and_portability.html index de08f43..6f1f9cd 100644 --- a/doc/html/boost_optional/dependencies_and_portability.html +++ b/doc/html/boost_optional/dependencies_and_portability.html @@ -3,7 +3,7 @@ Dependencies and Portability - + @@ -22,7 +22,7 @@
          PrevUpHomeNext
          -
          +

          Dependencies and Portability diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index 731a2c8..35c5a9c 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -3,7 +3,7 @@ Detailed Semantics - + @@ -22,7 +22,7 @@
          PrevUpHomeNext
          -
          +
          @@ -31,24 +31,24 @@ type, in the sequel, those entries whose semantic depends on T being of reference type or not will be distinguished using the following convention:

          -
            -
          • +
              +
            • If the entry reads: optional<T(not a ref)>, the description corresponds only to the case where T is not of reference type.
            • -
            • +
            • If the entry reads: optional<T&>, the description corresponds only to the case where T is of reference type.
            • -
            • +
            • If the entry reads: optional<T>, the description is the same for both cases.
            -
            +
            @@ -64,7 +64,7 @@ space

            - + optional class member functions

            @@ -82,21 +82,21 @@

            -
              -
            • +
                +
              • Effect: Default-Constructs an optional.
              • -
              • +
              • Postconditions:*this is uninitialized.
              • -
              • +
              • Throws: Nothing.
              • -
              • +
              • Notes: T's default constructor is not called.
              • -
              • +
              • Example:
                optional<T> def ;
                 assert ( !def ) ;
                 
                @@ -116,23 +116,23 @@

              -
                -
              • +
                  +
                • Effect: Constructs an optional uninitialized.
                • -
                • +
                • Postconditions:*this is uninitialized.
                • -
                • +
                • Throws: Nothing.
                • -
                • +
                • Notes:T's default constructor is not called. The expression boost::none denotes an instance of boost::none_t that can be used as the parameter.
                • -
                • +
                • Example:
                  #include <boost/none.hpp>
                   optional<T> n(none) ;
                   assert ( !n ) ;
                  @@ -153,31 +153,31 @@
                   

                -
                  -
                • +
                    +
                  • Effect: Directly-Constructs an optional.
                  • -
                  • +
                  • Postconditions:*this is initialized and its value is acopy of v.
                  • -
                  • +
                  • Throws: Whatever T::T( T const& ) throws.
                  • -
                  • +
                  • Notes: T::T( T const& ) is called.
                  • -
                  • +
                  • Exception Safety: Exceptions can only be thrown during T::T( T const& ); in that case, this constructor has no effect.
                  • -
                  • +
                  • Example:
                    T v;
                     optional<T> opt(v);
                     assert ( *opt == v ) ;
                    @@ -196,19 +196,19 @@
                     

                  -
                    -
                  • +
                      +
                    • Effect: Directly-Constructs an optional.
                    • -
                    • +
                    • Postconditions:*this is initialized and its value is an instance of an internal type wrapping the reference ref.
                    • -
                    • +
                    • Throws: Nothing.
                    • -
                    • +
                    • Example:
                      T v;
                       T& vref = v ;
                       optional<T&> opt(vref);
                      @@ -246,7 +246,7 @@
                       

                    -
                    • +
                      • If condition is true, same as:
                      @@ -269,14 +269,14 @@

                      -
                      • +
                        • otherwise, same as:

                        - optional<T [#(not a + optional<T ['(not a ref)]>::optional()

                        @@ -308,32 +308,32 @@

                        -
                          -
                        • +
                            +
                          • Effect: Copy-Constructs an optional.
                          • -
                          • +
                          • Postconditions: If rhs is initialized, *this is initialized and its value is a copy of the value of rhs; else *this is uninitialized.
                          • -
                          • +
                          • Throws: Whatever T::T( T const& ) throws.
                          • -
                          • +
                          • Notes: If rhs is initialized, T::T(T const& ) is called.
                          • -
                          • +
                          • Exception Safety: Exceptions can only be thrown during T::T( T const& ); in that case, this constructor has no effect.
                          • -
                          • +
                          • Example:
                            optional<T> uninit ;
                             assert (!uninit);
                             
                            @@ -360,11 +360,11 @@
                             

                          -
                            -
                          • +
                              +
                            • Effect: Copy-Constructs an optional.
                            • -
                            • +
                            • Postconditions: If rhs is initialized, *this is initialized and its value is another reference to the same object referenced @@ -372,16 +372,16 @@ else *this is uninitialized.
                            • -
                            • +
                            • Throws: Nothing.
                            • -
                            • +
                            • Notes: If rhs is initialized, both *this and *rhs will reefer to the same object (they alias).
                            • -
                            • +
                            • Example:
                              optional<T&> uninit ;
                               assert (!uninit);
                               
                              @@ -417,11 +417,11 @@
                               

                            -
                              -
                            • +
                                +
                              • Effect: Copy-Constructs an optional.
                              • -
                              • +
                              • Postconditions: If rhs is initialized, *this is initialized and its value is a copy of the value @@ -429,25 +429,25 @@ else *this is uninitialized.
                              • -
                              • +
                              • Throws: Whatever T::T( U const& ) throws.
                              • -
                              • +
                              • Notes: T::T( U const& ) is called if rhs is initialized, which requires a valid conversion from U to T.
                              • -
                              • +
                              • Exception Safety: Exceptions can only be thrown during T::T( U const& ); in that case, this constructor has no effect.
                              • -
                              • +
                              • Example:
                                optional<double> x(123.4);
                                 assert ( *x == 123.4 ) ;
                                 
                                @@ -483,31 +483,31 @@
                                 

                              -
                                -
                              • +
                                  +
                                • Effect: Constructs an optional with a value of T obtained from the factory.
                                • -
                                • +
                                • Postconditions: *this is initialized and its value is directly given from the factory f (i.e., the value is not copied).
                                • -
                                • +
                                • Throws: Whatever the T constructor called by the factory throws.
                                • -
                                • +
                                • Notes: See In-Place Factories
                                • -
                                • +
                                • Exception Safety: Exceptions can only be thrown during the call to the T constructor used by the factory; in that case, this constructor has no effect.
                                • -
                                • +
                                • Example:
                                  class C { C ( char, double, std::string ) ; } ;
                                   
                                   C v('A',123.4,"hello");
                                  @@ -538,25 +538,25 @@
                                   

                                -
                                  -
                                • +
                                    +
                                  • Effect: Assigns the value rhs to an optional.
                                  • -
                                  • +
                                  • Postconditions: *this is initialized and its value is a copy of rhs.
                                  • -
                                  • +
                                  • Throws: Whatever T::operator=( T const& ) or T::T(T const&) throws.
                                  • -
                                  • +
                                  • Notes: If *this was initialized, T's assignment operator is used, otherwise, its copy-constructor is used.
                                  • -
                                  • +
                                  • Exception Safety: In the event of an exception, the initialization state of *this is unchanged and its value unspecified as far as optional is concerned @@ -565,7 +565,7 @@ is initially uninitialized and T's copy constructor fails, *this is left properly uninitialized.
                                  • -
                                  • +
                                  • Example:
                                    T x;
                                     optional<T> def ;
                                     optional<T> opt(x) ;
                                    @@ -594,20 +594,20 @@
                                     

                                  -
                                    -
                                  • +
                                      +
                                    • Effect: (Re)binds thee wrapped reference.
                                    • -
                                    • +
                                    • Postconditions: *this is initialized and it references the same object referenced by rhs.
                                    • -
                                    • +
                                    • Notes: If *this was initialized, is is rebound to the new object. See here for details on this behavior.
                                    • -
                                    • +
                                    • Example:
                                      int a = 1 ;
                                       int b = 2 ;
                                       T& ra = a ;
                                      @@ -645,29 +645,29 @@
                                       

                                    -
                                      -
                                    • +
                                        +
                                      • Effect: Assigns another optional to an optional.
                                      • -
                                      • +
                                      • Postconditions: If rhs is initialized, *this is initialized and its value is a copy of the value of rhs; else *this is uninitialized.
                                      • -
                                      • +
                                      • Throws: Whatever T::operator( T const&) or T::T( T const& ) throws.
                                      • -
                                      • +
                                      • Notes: If both *this and rhs are initially initialized, T's assignment operator is used. If *this is initially initialized but rhs is uninitialized, T's [destructor] is called. If *this is initially uninitialized but rhs is initialized, T's copy constructor is called.
                                      • -
                                      • +
                                      • Exception Safety: In the event of an exception, the initialization state of *this is unchanged and its value unspecified as far as optional is concerned (it is up to T's @@ -676,7 +676,7 @@ is initially uninitialized and T's copy constructor fails, *this is left properly uninitialized.
                                      • -
                                      • +
                                      • Example:
                                        T v;
                                         optional<T> opt(v);
                                         optional<T> def ;
                                        @@ -700,20 +700,20 @@
                                         

                                      -
                                        -
                                      • +
                                          +
                                        • Effect: (Re)binds thee wrapped reference.
                                        • -
                                        • +
                                        • Postconditions: If *rhs is initialized, *this is initialized and it references the same object referenced by *rhs; otherwise, *this is uninitialized (and references no object).
                                        • -
                                        • +
                                        • Notes: If *this was initialized and so is *rhs, this is is rebound to the new object. See here for details on this behavior.
                                        • -
                                        • +
                                        • Example:
                                          int a = 1 ;
                                           int b = 2 ;
                                           T& ra = a ;
                                          @@ -750,25 +750,25 @@
                                           

                                        -
                                          -
                                        • +
                                            +
                                          • Effect: Assigns another convertible optional to an optional.
                                          • -
                                          • +
                                          • Postconditions: If rhs is initialized, *this is initialized and its value is a copy of the value of rhsconverted to type T; else *this is uninitialized.
                                          • -
                                          • +
                                          • Throws: Whatever T::operator=( U const& ) or T::T( U const& ) throws.
                                          • -
                                          • +
                                          • Notes: If both *this and rhs are initially initialized, T's assignment operator (from U) is used. If *this is initially initialized but rhs is uninitialized, @@ -778,7 +778,7 @@ converting constructor (from U) is called.
                                          • -
                                          • +
                                          • Exception Safety: In the event of an exception, the initialization state of *this is unchanged and its value unspecified as far as optional is concerned (it is up to T's @@ -787,7 +787,7 @@ is initially uninitialized and T's converting constructor fails, *this is left properly uninitialized.
                                          • -
                                          • +
                                          • Example:
                                            T v;
                                             optional<T> opt0(v);
                                             optional<U> opt1;
                                            @@ -812,7 +812,7 @@
                                             

                                          -
                                          • +
                                            • Deprecated: same as operator= ( T const& v) ; @@ -831,7 +831,7 @@

                                            -
                                            • +
                                              • Deprecated: Same as operator=( detail::none_t );

                                              @@ -902,21 +902,21 @@

                                            -
                                              -
                                            • +
                                                +
                                              • Requirements:*this is initialized
                                              • -
                                              • +
                                              • Returns: A reference to the contained value
                                              • -
                                              • +
                                              • Throws: Nothing.
                                              • -
                                              • +
                                              • Notes: The requirement is asserted via BOOST_ASSERT().
                                              • -
                                              • +
                                              • Example:
                                                T v ;
                                                 optional<T> opt ( v );
                                                 T const& u = *opt;
                                                @@ -982,15 +982,15 @@
                                                 

                                              -
                                                -
                                              • +
                                                  +
                                                • Returns: A reference to the contained value, if any, or default.
                                                • -
                                                • +
                                                • Throws: Nothing.
                                                • -
                                                • +
                                                • Example:
                                                  T v, z ;
                                                   optional<T> def;
                                                   T const& y = def.get_value_or(z);
                                                  @@ -1068,22 +1068,22 @@
                                                   

                                                -
                                                  -
                                                • +
                                                    +
                                                  • Requirements: *this is initialized
                                                  • -
                                                  • +
                                                  • Returns:The reference contained.
                                                  • -
                                                  • +
                                                  • Throws: Nothing.
                                                  • -
                                                  • +
                                                  • Notes: The requirement is asserted via BOOST_ASSERT().
                                                  • -
                                                  • +
                                                  • Example:
                                                    T v ;
                                                     T& vref = v ;
                                                     optional<T&> opt ( vref );
                                                    @@ -1143,20 +1143,20 @@
                                                     

                                                  -
                                                    -
                                                  • +
                                                      +
                                                    • Returns: If *this is initialized, a pointer to the contained value; else 0 (null).
                                                    • -
                                                    • +
                                                    • Throws: Nothing.
                                                    • -
                                                    • +
                                                    • Notes: The contained value is permanently stored within *this, so you should not hold nor delete this pointer
                                                    • -
                                                    • +
                                                    • Example:
                                                      T v;
                                                       optional<T> opt(v);
                                                       optional<T> const copt(v);
                                                      @@ -1194,21 +1194,21 @@
                                                       

                                                    -
                                                      -
                                                    • +
                                                        +
                                                      • Requirements: *this is initialized.
                                                      • -
                                                      • +
                                                      • Returns: A pointer to the contained value.
                                                      • -
                                                      • +
                                                      • Throws: Nothing.
                                                      • -
                                                      • +
                                                      • Notes: The requirement is asserted via BOOST_ASSERT().
                                                      • -
                                                      • +
                                                      • Example:
                                                        struct X { int mdata ; } ;
                                                         X x ;
                                                         optional<X> opt (x);
                                                        @@ -1230,15 +1230,15 @@
                                                         

                                                      -
                                                        -
                                                      • +
                                                          +
                                                        • Returns: An unspecified value which if used on a boolean context is equivalent to (get() != 0)
                                                        • -
                                                        • +
                                                        • Throws: Nothing.
                                                        • -
                                                        • +
                                                        • Example:
                                                          optional<T> def ;
                                                           assert ( def == 0 );
                                                           optional<T> opt ( v ) ;
                                                          @@ -1261,20 +1261,20 @@
                                                           

                                                        -
                                                          -
                                                        • +
                                                            +
                                                          • Returns: If *this is uninitialized, true; else false.
                                                          • -
                                                          • +
                                                          • Throws: Nothing.
                                                          • -
                                                          • +
                                                          • Notes: This operator is provided for those compilers which can't use the unspecified-bool-type operator in certain boolean contexts.
                                                          • -
                                                          • +
                                                          • Example:
                                                            optional<T> opt ;
                                                             assert ( !opt );
                                                             *opt = some_T ;
                                                            @@ -1298,16 +1298,16 @@
                                                             

                                                          -
                                                            -
                                                          • +
                                                              +
                                                            • Returns: true if the optional is initialized, false otherwise.
                                                            • -
                                                            • +
                                                            • Throws: Nothing.
                                                            • -
                                                            • +
                                                            • Example:
                                                              optional<T> def ;
                                                               assert ( !def.is_initialized() );
                                                               optional<T> opt ( v ) ;
                                                              @@ -1319,7 +1319,7 @@
                                                                     space
                                                                   

                                                              - + Free functions

                                                              @@ -1336,13 +1336,13 @@

                                                            -
                                                              -
                                                            • +
                                                                +
                                                              • Returns: optional<T>(v) for the deduced type T of v.
                                                              • -
                                                              • +
                                                              • Example:
                                                                template<class T> void foo ( optional<T> const& opt ) ;
                                                                 
                                                                 foo ( make_optional(1+1) ) ; // Creates an optional<int>
                                                                @@ -1364,13 +1364,13 @@
                                                                 

                                                              -
                                                                -
                                                              • +
                                                                  +
                                                                • Returns: optional<T>(condition,v) for the deduced type T of v.
                                                                • -
                                                                • +
                                                                • Example:
                                                                  optional<double> calculate_foo()
                                                                   {
                                                                     double val = compute_foo();
                                                                  @@ -1398,17 +1398,17 @@
                                                                   

                                                                -
                                                                  -
                                                                • +
                                                                    +
                                                                  • Returns: If both x and y are initialized, (*x == *y). If only x or y is initialized, false. If both are uninitialized, true.
                                                                  • -
                                                                  • +
                                                                  • Throws: Nothing.
                                                                  • -
                                                                  • +
                                                                  • Notes: Pointers have shallow relational operators while optional has deep relational operators. Do not use operator @@ -1417,7 +1417,7 @@ or a pointer; use equal_pointees() instead
                                                                  • -
                                                                  • +
                                                                  • Example:
                                                                    T x(12);
                                                                     T y(12);
                                                                     T z(21);
                                                                    @@ -1459,17 +1459,17 @@
                                                                     

                                                                  -
                                                                    -
                                                                  • +
                                                                      +
                                                                    • Returns: If y is not initialized, false. If y is initialized and x is not initialized, true. If both x and y are initialized, (*x < *y).
                                                                    • -
                                                                    • +
                                                                    • Throws: Nothing.
                                                                    • -
                                                                    • +
                                                                    • Notes: Pointers have shallow relational operators while optional has deep relational operators. Do not use operator @@ -1478,7 +1478,7 @@ or a pointer; use less_pointees() instead.
                                                                    • -
                                                                    • +
                                                                    • Example:
                                                                      T x(12);
                                                                       T y(34);
                                                                       optional<T> def ;
                                                                      @@ -1516,13 +1516,13 @@
                                                                       

                                                                    -
                                                                      -
                                                                    • +
                                                                        +
                                                                      • Returns: !( x == y );
                                                                      • -
                                                                      • +
                                                                      • Throws: Nothing.
                                                                      @@ -1542,13 +1542,13 @@

                                                                    -
                                                                      -
                                                                    • +
                                                                        +
                                                                      • Returns: ( y < x );
                                                                      • -
                                                                      • +
                                                                      • Throws: Nothing.
                                                                      @@ -1568,12 +1568,12 @@

                                                                    -
                                                                      -
                                                                    • +
                                                                        +
                                                                      • Returns: !( y<x );
                                                                      • -
                                                                      • +
                                                                      • Throws: Nothing.
                                                                      @@ -1593,12 +1593,12 @@

                                                                    -
                                                                      -
                                                                    • +
                                                                        +
                                                                      • Returns: !( x<y );
                                                                      • -
                                                                      • +
                                                                      • Throws: Nothing.
                                                                      @@ -1618,37 +1618,37 @@

                                                                    -
                                                                      -
                                                                    • +
                                                                        +
                                                                      • Effect: If both x and y are initialized, calls swap(*x,*y) using std::swap. If only one is initialized, say x, calls: y.reset(*x); x.reset(); If none is initialized, does nothing.
                                                                      • -
                                                                      • +
                                                                      • Postconditions: The states of x and y interchanged.
                                                                      • -
                                                                      • +
                                                                      • Throws: If both are initialized, whatever swap(T&,T&) throws. If only one is initialized, whatever T::T ( T const& ) throws.
                                                                      • -
                                                                      • +
                                                                      • Notes: If both are initialized, swap(T&,T&) is used unqualified but with std::swap introduced in scope. If only one is initialized, T::~T() and T::T( T const& ) is called.
                                                                      • -
                                                                      • +
                                                                      • Exception Safety: If both are initialized, this operation has the exception safety guarantees of swap(T&,T&). If only one is initialized, it has the same basic guarantee as optional<T>::reset( T const& ).
                                                                      • -
                                                                      • +
                                                                      • Example:
                                                                        T x(12);
                                                                         T y(21);
                                                                         optional<T> def0 ;
                                                                        diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html
                                                                        index 1df4a70..7c96256 100644
                                                                        --- a/doc/html/boost_optional/development.html
                                                                        +++ b/doc/html/boost_optional/development.html
                                                                        @@ -3,7 +3,7 @@
                                                                         
                                                                         Development
                                                                         
                                                                        -
                                                                        +
                                                                         
                                                                         
                                                                         
                                                                        @@ -22,7 +22,7 @@
                                                                         
                                                                        PrevUpHomeNext
                                                                        -
                                                                        + -
                                                                        +
                                                                        @@ -110,28 +110,28 @@

                                                                        Discriminated-union:

                                                                        -
                                                                          -
                                                                        • +
                                                                            +
                                                                          • deep-copy semantics: copies of the variant implies copies of the value.
                                                                          • -
                                                                          • +
                                                                          • deep-relational semantics: comparisons between variants matches both current types and values
                                                                          • -
                                                                          • +
                                                                          • If the variant's current type is T, it is modeling an initialized optional.
                                                                          • -
                                                                          • +
                                                                          • If the variant's current type is not T, it is modeling an uninitialized optional.
                                                                          • -
                                                                          • +
                                                                          • Testing if the variant's current type is T models testing if the optional is initialized
                                                                          • -
                                                                          • +
                                                                          • Trying to extract a T from a variant when its current type is not T, models the undefined behavior of trying to access the value of an uninitialized @@ -141,34 +141,34 @@

                                                                            Single-element container:

                                                                            -
                                                                              -
                                                                            • +
                                                                                +
                                                                              • deep-copy semantics: copies of the container implies copies of the value.
                                                                              • -
                                                                              • +
                                                                              • deep-relational semantics: comparisons between containers compare container size and if match, contained value
                                                                              • -
                                                                              • +
                                                                              • If the container is not empty (contains an object of type T), it is modeling an initialized optional.
                                                                              • -
                                                                              • +
                                                                              • If the container is empty, it is modeling an uninitialized optional.
                                                                              • -
                                                                              • +
                                                                              • Testing if the container is empty models testing if the optional is initialized
                                                                              • -
                                                                              • +
                                                                              • Trying to extract a T from an empty container models the undefined behavior of trying to access the value of an uninitialized optional
                                                                            -
                                                                            +
                                                                            @@ -193,55 +193,55 @@ We can draw from the purpose of optional<T> the required basic semantics:

                                                                            -
                                                                              -
                                                                            • +
                                                                                +
                                                                              • Default Construction: To introduce a formally uninitialized wrapped object.
                                                                              • -
                                                                              • +
                                                                              • Direct Value Construction via copy: To introduce a formally initialized wrapped object whose value is obtained as a copy of some object.
                                                                              • -
                                                                              • +
                                                                              • Deep Copy Construction: To obtain a new yet equivalent wrapped object.
                                                                              • -
                                                                              • +
                                                                              • Direct Value Assignment (upon initialized): To assign a value to the wrapped object.
                                                                              • -
                                                                              • +
                                                                              • Direct Value Assignment (upon uninitialized): To initialize the wrapped object with a value obtained as a copy of some object.
                                                                              • -
                                                                              • +
                                                                              • Assignment (upon initialized): To assign to the wrapped object the value of another wrapped object.
                                                                              • -
                                                                              • +
                                                                              • Assignment (upon uninitialized): To initialize the wrapped object with value of another wrapped object.
                                                                              • -
                                                                              • +
                                                                              • Deep Relational Operations (when supported by the type T): To compare wrapped object values taking into account the presence of uninitialized states.
                                                                              • -
                                                                              • +
                                                                              • Value access: To unwrap the wrapped object.
                                                                              • -
                                                                              • +
                                                                              • Initialization state query: To determine if the object is formally initialized or not.
                                                                              • -
                                                                              • +
                                                                              • Swap: To exchange wrapped objects. (with whatever exception safety guarantees are provided by T's swap).
                                                                              • -
                                                                              • +
                                                                              • De-initialization: To release the wrapped object (if any) and leave the wrapper in the uninitialized state.
                                                                              • @@ -252,7 +252,7 @@ via a pointer to the wrapped object or null.

                                                                              -
                                                                              +
                                                                              @@ -292,7 +292,7 @@ itself which are supported by a special interface.

                                                                              - + Lexically-hinted Value Access in the presence of possibly untitialized optional objects: The operators * and -> @@ -357,7 +357,7 @@ incarnated by pointers.

                                                                              - + Optional<T> as a model of OptionalPointee
                                                                              @@ -367,7 +367,7 @@ about the possibly uninitialized state appealing to the familiar pointer semantics w.r.t. to null pointers.

                                                                              -
            [Note] Note
            +
            diff --git a/doc/html/boost_optional/examples.html b/doc/html/boost_optional/examples.html index 9c8764b..95c4ab1 100644 --- a/doc/html/boost_optional/examples.html +++ b/doc/html/boost_optional/examples.html @@ -3,7 +3,7 @@ Examples - + @@ -22,7 +22,7 @@
            PrevUpHomeNext
            -
            + -
            +

            Optional return values @@ -57,7 +57,7 @@ }

            -
            +

            Optional local variables @@ -78,7 +78,7 @@ else print("employer's name not found!");

            -
            +

            Optional data members @@ -116,7 +116,7 @@ };

            -
            +

            Bypassing expensive unnecessary default construction diff --git a/doc/html/boost_optional/exception_safety_guarantees.html b/doc/html/boost_optional/exception_safety_guarantees.html index d863a86..cf3577e 100644 --- a/doc/html/boost_optional/exception_safety_guarantees.html +++ b/doc/html/boost_optional/exception_safety_guarantees.html @@ -3,7 +3,7 @@ Exception Safety Guarantees - + @@ -22,7 +22,7 @@
            PrevUpHomeNext
            -
            +

            Exception Safety Guarantees @@ -31,21 +31,21 @@ Because of the current implementation (see Implementation Notes), all of the assignment methods:

            -
              -
            • optional<T>::operator= ( optional<T> +
                +
              • optional<T>::operator= ( optional<T> const& )
              • -
              • optional<T>::operator= ( T const& )
              • -
              • template<class U> optional<T>::operator= ( optional<U> +
              • optional<T>::operator= ( T const& )
              • +
              • template<class U> optional<T>::operator= ( optional<U> const& )
              • -
              • template<class InPlaceFactory> optional<T>::operator= ( InPlaceFactory +
              • template<class InPlaceFactory> optional<T>::operator= ( InPlaceFactory const& )
              • -
              • template<class TypedInPlaceFactory> optional<T>::operator= ( TypedInPlaceFactory +
              • template<class TypedInPlaceFactory> optional<T>::operator= ( TypedInPlaceFactory const& )
              • -
              • optional<T>:::reset ( T const&)
              • +
              • optional<T>:::reset ( T const&)

              Can only guarantee the basic @@ -56,9 +56,9 @@

              On the other hand, the uninitializing methods:

              -
                -
              • optional<T>::operator= ( detail::none_t )
              • -
              • optional<T>::reset()
              • +
                  +
                • optional<T>::operator= ( detail::none_t )
                • +
                • optional<T>::reset()

                Provide the no-throw guarantee (assuming a no-throw T::~T()) @@ -112,7 +112,7 @@ }

                - + Swap

                diff --git a/doc/html/boost_optional/implementation_notes.html b/doc/html/boost_optional/implementation_notes.html index 8308c01..bdaa201 100644 --- a/doc/html/boost_optional/implementation_notes.html +++ b/doc/html/boost_optional/implementation_notes.html @@ -3,7 +3,7 @@ Implementation Notes - + @@ -22,7 +22,7 @@

                PrevUpHomeNext
                -
                +
                diff --git a/doc/html/boost_optional/in_place_factories.html b/doc/html/boost_optional/in_place_factories.html index 0c89689..e23a41b 100644 --- a/doc/html/boost_optional/in_place_factories.html +++ b/doc/html/boost_optional/in_place_factories.html @@ -3,7 +3,7 @@ In-Place Factories - + @@ -22,7 +22,7 @@
                PrevUpHomeNext
                -
                +
                @@ -127,12 +127,12 @@

                The factories are divided in two groups:

                -
                  -
                • +
                    +
                  • TypedInPlaceFactories: those which take the target type as a primary template parameter.
                  • -
                  • +
                  • InPlaceFactories: those with a template construct(void*) member function taking the target type. diff --git a/doc/html/boost_optional/optional_references.html b/doc/html/boost_optional/optional_references.html index 90a5144..9222d48 100644 --- a/doc/html/boost_optional/optional_references.html +++ b/doc/html/boost_optional/optional_references.html @@ -3,7 +3,7 @@ Optional references - + @@ -22,7 +22,7 @@
                    PrevUpHomeNext
                    -
                    +
                    @@ -35,20 +35,20 @@ However, since references are not real objects some restrictions apply and some operations are not available in this case:

                    -
                      -
                    • +
                        +
                      • Converting constructors
                      • -
                      • +
                      • Converting assignment
                      • -
                      • +
                      • InPlace construction
                      • -
                      • +
                      • InPlace assignment
                      • -
                      • +
                      • Value-access via pointer
                      @@ -57,13 +57,13 @@ treats it wrapped pseudo-object much as a real value, a true real reference is stored so aliasing will ocurr:

                      -
                        -
                      • +
                          +
                        • Copies of optional<T&> will copy the references but all these references will nonetheless reefer to the same object.
                        • -
                        • +
                        • Value-access will actually provide access to the referenced object rather than the reference itself.
                        • diff --git a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html index 3b11e4f..4f06a6c 100644 --- a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html +++ b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html @@ -3,7 +3,7 @@ Rebinding semantics for assignment of optional references - + @@ -22,7 +22,7 @@
                          PrevUpHomeNext
                          -
                          +

                          Rebinding semantics for assignment of optional references @@ -70,7 +70,7 @@ assert(b==3);

                          - + Rationale

                          diff --git a/doc/html/boost_optional/synopsis.html b/doc/html/boost_optional/synopsis.html index 3abdcd3..32472d3 100644 --- a/doc/html/boost_optional/synopsis.html +++ b/doc/html/boost_optional/synopsis.html @@ -3,7 +3,7 @@ Synopsis - + @@ -22,7 +22,7 @@

                          PrevUpHomeNext
                          -
                          +
                          diff --git a/doc/html/boost_optional/type_requirements.html b/doc/html/boost_optional/type_requirements.html index efc6caa..aae6ec9 100644 --- a/doc/html/boost_optional/type_requirements.html +++ b/doc/html/boost_optional/type_requirements.html @@ -3,7 +3,7 @@ Type requirements - + @@ -22,7 +22,7 @@
                          PrevUpHomeNext
                          -
                          +
                          diff --git a/doc/html/index.html b/doc/html/index.html index 6f2be2c..981800c 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Boost.Optional - + @@ -18,7 +18,7 @@

            [Warning] Warning

            Next
            -
            +

            Chapter 1. Boost.Optional

            @@ -26,8 +26,8 @@ Fernando Luis Cacciola Carballal

          -
          -

          +

          +

          Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

          @@ -71,7 +71,7 @@
          Acknowledgments
          -
          +
          @@ -79,15 +79,15 @@ Consider these functions which should return a value but which might not have a value to return:

          -
            -
          • +
              +
            • (A) double sqrt(double n );
            • -
            • +
            • (B) char get_async_input();
            • -
            • +
            • (C) point polygon::get_any_point_effectively_inside();
            @@ -166,7 +166,7 @@

          - +

          Last revised: February 09, 2009 at 11:55:08 GMT

          Last revised: November 20, 2009 at 10:24:28 GMT


          From 16f0a0aaafe5b66518e6d73a7fecf4c59ae6f2c4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 6 May 2010 21:44:18 +0000 Subject: [PATCH 24/36] Expose the "types" typedef of boost::optional_detail::operator_base as public, rather than protected, since Spirit pokes at this typedef. [SVN r61832] --- include/boost/optional/optional.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 01db469..0dd1c62 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -173,8 +173,10 @@ class optional_base : public optional_tag typedef BOOST_DEDUCED_TYPENAME is_reference::type is_reference_predicate ; + public: typedef BOOST_DEDUCED_TYPENAME mpl::if_::type types ; + protected: typedef bool (this_type::*unspecified_bool_type)() const; typedef BOOST_DEDUCED_TYPENAME types::reference_type reference_type ; From bccd75c72fb64dddb253432fcab55bb6441512e3 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 20 Jun 2010 18:00:48 +0000 Subject: [PATCH 25/36] Update various libraries' documentation build. Mostly to use the images and css files under doc/src instead of doc/html, usually be deleting the settings in order to use the defaults. Also add 'boost.root' to some builds in order to fix links which rely on it. [SVN r63146] --- doc/Jamfile.v2 | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index eeb464c..9a59127 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -24,7 +24,6 @@ boostbook standalone optional : boost.root=../../../.. - boost.libraries=../../../libraries.htm toc.max.depth=2 toc.section.depth=2 chunk.section.depth=1 From 97e314f03adf256139e5ff85dcd7a17932afb059 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 14 Jul 2010 08:15:33 +0000 Subject: [PATCH 26/36] Fix some header links. [SVN r64006] --- include/boost/detail/none_t.hpp | 2 +- include/boost/optional/optional.hpp | 2 +- include/boost/optional/optional_fwd.hpp | 2 +- include/boost/optional/optional_io.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/detail/none_t.hpp b/include/boost/detail/none_t.hpp index 76ba97a..40805ec 100644 --- a/include/boost/detail/none_t.hpp +++ b/include/boost/detail/none_t.hpp @@ -4,7 +4,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -// See http://www.boost.org/lib/optional for documentation. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 0dd1c62..f38fcd0 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -4,7 +4,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -// See http://www.boost.org/lib/optional for documentation. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/optional/optional_fwd.hpp b/include/boost/optional/optional_fwd.hpp index a74fe10..388cc1c 100644 --- a/include/boost/optional/optional_fwd.hpp +++ b/include/boost/optional/optional_fwd.hpp @@ -4,7 +4,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -// See http://www.boost.org/lib/optional for documentation. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/optional/optional_io.hpp b/include/boost/optional/optional_io.hpp index ef1ecaf..85a1857 100644 --- a/include/boost/optional/optional_io.hpp +++ b/include/boost/optional/optional_io.hpp @@ -4,7 +4,7 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -// See http://www.boost.org/lib/optional for documentation. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com From 57c07c7a57281a1094b44590e846b4ed1d5d3be3 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 19 Jul 2010 20:17:58 +0000 Subject: [PATCH 27/36] Fix doc build for 2 libraries which use own css. I changed the default to use doc/src/boostbook.css. So add an explicit location to libraries which use their own stylesheet. [SVN r64170] --- doc/Jamfile.v2 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 9a59127..93998d0 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -24,6 +24,7 @@ boostbook standalone optional : boost.root=../../../.. + html.stylesheet=boostbook.css toc.max.depth=2 toc.section.depth=2 chunk.section.depth=1 From 425d141cbf4ce036b4c5ae0ead688803c90d4c41 Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Tue, 20 Jul 2010 18:20:01 +0000 Subject: [PATCH 28/36] Test for fixed extraction operator for empty optinals [SVN r64205] --- test/optional_test_io.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/optional_test_io.cpp b/test/optional_test_io.cpp index 13e8a5d..d4ee207 100644 --- a/test/optional_test_io.cpp +++ b/test/optional_test_io.cpp @@ -55,10 +55,14 @@ void test2( Opt o, Opt buff ) { stringstream s ; - s << o ; - s >> buff ; + const int markv = 123 ; + int mark = 0 ; + + s << o << " " << markv ; + s >> buff >> mark ; BOOST_ASSERT( buff == o ) ; + BOOST_ASSERT( mark == markv ) ; } @@ -77,7 +81,6 @@ int test_main( int, char* [] ) { test(1,2); test(string("hello"),string("buffer")); - test(string(""),string("buffer")); } catch ( ... ) { From c93e5a88c7846b5f7cdf6af3aad2365f3fc7dba9 Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Tue, 20 Jul 2010 18:20:40 +0000 Subject: [PATCH 29/36] Fixed extraction operator for empty optionals [SVN r64206] --- include/boost/optional/optional_io.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/boost/optional/optional_io.hpp b/include/boost/optional/optional_io.hpp index 85a1857..85ba7b3 100644 --- a/include/boost/optional/optional_io.hpp +++ b/include/boost/optional/optional_io.hpp @@ -25,7 +25,7 @@ # include #endif - +#include #include "boost/optional/optional.hpp" #include "boost/utility/value_init.hpp" @@ -72,7 +72,12 @@ operator>>(std::basic_istream& in, optional& v) v = x ; } else + { + BOOST_ASSERT(d == '-'); + d = in.get(); + BOOST_ASSERT(d == '-'); v = optional() ; + } } return in; From 8608ad14972e4db353045cfaf4e24f75b8851327 Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Tue, 20 Jul 2010 19:21:44 +0000 Subject: [PATCH 30/36] Fixed behaviour in case of invalid input [SVN r64208] --- include/boost/optional/optional_io.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/boost/optional/optional_io.hpp b/include/boost/optional/optional_io.hpp index 85ba7b3..a64d0f5 100644 --- a/include/boost/optional/optional_io.hpp +++ b/include/boost/optional/optional_io.hpp @@ -73,9 +73,14 @@ operator>>(std::basic_istream& in, optional& v) } else { - BOOST_ASSERT(d == '-'); + if ( d != '-') + in.setstate( ios::failbit ); + d = in.get(); - BOOST_ASSERT(d == '-'); + + if ( d != '-') + in.setstate( ios::failbit ); + v = optional() ; } } From ab01dfff7ee89ac16d3f193e284e2313e036eace Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Sun, 25 Jul 2010 22:21:45 +0000 Subject: [PATCH 31/36] Fully qualify ios flags. Fixes compilation of PropertyTree, bug 4459. [SVN r64342] --- include/boost/optional/optional_io.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/optional/optional_io.hpp b/include/boost/optional/optional_io.hpp index a64d0f5..c5d3c31 100644 --- a/include/boost/optional/optional_io.hpp +++ b/include/boost/optional/optional_io.hpp @@ -74,12 +74,12 @@ operator>>(std::basic_istream& in, optional& v) else { if ( d != '-') - in.setstate( ios::failbit ); + in.setstate( std::ios::failbit ); d = in.get(); if ( d != '-') - in.setstate( ios::failbit ); + in.setstate( std::ios::failbit ); v = optional() ; } From f88c8ae423c1b164844f07e0ef8800ca11ba3340 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 5 Dec 2010 14:43:18 +0000 Subject: [PATCH 32/36] Refs #3395. Optional construction and assignment now works correctly for types with overridden operator&. Also silenced some GCC warnings about broken strict aliasing rules. [SVN r67020] --- include/boost/optional/optional.hpp | 63 ++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index f38fcd0..4e4e4bb 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -11,12 +11,12 @@ // // Revisions: // 27 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen -// +// #ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP #define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP -#include -#include +#include +#include #include "boost/config.hpp" #include "boost/assert.hpp" @@ -31,6 +31,7 @@ #include "boost/mpl/not.hpp" #include "boost/detail/reference_content.hpp" #include "boost/none.hpp" +#include "boost/utility/addressof.hpp" #include "boost/utility/compare_pointees.hpp" #include "boost/utility/in_place_factory.hpp" @@ -110,7 +111,12 @@ template class aligned_storage { // Borland ICEs if unnamed unions are used for this! - union dummy_u + union +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) + // This works around GCC warnings about breaking strict aliasing rules when casting storage address to T* + __attribute__((may_alias)) +#endif + dummy_u { char data[ sizeof(T) ]; BOOST_DEDUCED_TYPENAME type_with_alignment< @@ -119,8 +125,13 @@ class aligned_storage public: - void const* address() const { return &dummy_.data[0]; } - void * address() { return &dummy_.data[0]; } +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) + void const* address() const { return &dummy_; } + void * address() { return &dummy_; } +#else + void const* address() const { return dummy_.data; } + void * address() { return dummy_.data; } +#endif } ; template @@ -154,7 +165,7 @@ class optional_base : public optional_tag typedef #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) BOOST_DEDUCED_TYPENAME -#endif +#endif ::boost::detail::make_reference_content::type internal_type ; typedef aligned_storage storage_type ; @@ -205,7 +216,7 @@ class optional_base : public optional_tag { construct(val); } - + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialzed optional. // Can throw if T::T(T const&) does optional_base ( bool cond, argument_type val ) @@ -426,8 +437,22 @@ class optional_base : public optional_tag private : // internal_type can be either T or reference_content +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) + // This workaround is supposed to silence GCC warnings about broken strict aliasing rules + internal_type const* get_object() const + { + union { void const* ap_pvoid; internal_type const* as_ptype; } caster = { m_storage.address() }; + return caster.as_ptype; + } + internal_type * get_object() + { + union { void* ap_pvoid; internal_type* as_ptype; } caster = { m_storage.address() }; + return caster.as_ptype; + } +#else internal_type const* get_object() const { return static_cast(m_storage.address()); } internal_type * get_object() { return static_cast (m_storage.address()); } +#endif // reference_content lacks an implicit conversion to T&, so the following is needed to obtain a proper reference. reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; } @@ -518,7 +543,7 @@ class optional : public optional_detail::optional_base // Depending on the above some T ctor is called. // Can throw is the resolved T ctor throws. template - explicit optional ( Expr const& expr ) : base(expr,&expr) {} + explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {} #endif // Creates a deep copy of another optional @@ -532,9 +557,9 @@ class optional : public optional_detail::optional_base // Assigns from an expression. See corresponding constructor. // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED template - optional& operator= ( Expr expr ) + optional& operator= ( Expr const& expr ) { - this->assign_expr(expr,&expr); + this->assign_expr(expr,boost::addressof(expr)); return *this ; } #endif @@ -595,7 +620,7 @@ class optional : public optional_detail::optional_base // Returns a copy of the value if this is initialized, 'v' otherwise reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } - + // Returns a pointer to the value if this is initialized, otherwise, // the behaviour is UNDEFINED // No-throw @@ -612,22 +637,22 @@ class optional : public optional_detail::optional_base // No-throw operator unspecified_bool_type() const { return this->safe_bool() ; } - // This is provided for those compilers which don't like the conversion to bool - // on some contexts. - bool operator!() const { return !this->is_initialized() ; } + // This is provided for those compilers which don't like the conversion to bool + // on some contexts. + bool operator!() const { return !this->is_initialized() ; } } ; // Returns optional(v) -template -inline +template +inline optional make_optional ( T const& v ) { return optional(v); } // Returns optional(cond,v) -template -inline +template +inline optional make_optional ( bool cond, T const& v ) { return optional(cond,v); From d39627c5b610628d19cccb5b72466a9b19be35e6 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 8 Dec 2010 17:53:29 +0000 Subject: [PATCH 33/36] boost/optional/optional.hpp: avoid gcc 3.2 warnings [SVN r67109] --- include/boost/optional/optional.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 4e4e4bb..e2e4fcc 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -103,6 +103,12 @@ class typed_in_place_factory_base ; namespace optional_detail { +#if defined(__GNUC__) \ + && !(__GNUC__ == 3 && __GNUC_MINOR__ == 2) \ + && !defined(__INTEL_COMPILER) +#define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS +#endif + // This local class is used instead of that in "aligned_storage.hpp" // because I've found the 'official' class to ICE BCB5.5 // when some types are used with optional<> @@ -112,8 +118,8 @@ class aligned_storage { // Borland ICEs if unnamed unions are used for this! union -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) // This works around GCC warnings about breaking strict aliasing rules when casting storage address to T* +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) __attribute__((may_alias)) #endif dummy_u @@ -125,7 +131,7 @@ class aligned_storage public: -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) void const* address() const { return &dummy_; } void * address() { return &dummy_; } #else @@ -437,7 +443,7 @@ class optional_base : public optional_tag private : // internal_type can be either T or reference_content -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) // This workaround is supposed to silence GCC warnings about broken strict aliasing rules internal_type const* get_object() const { From 64d8062621d07f390482968927d2e0a415280b2c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 8 Dec 2010 18:32:36 +0000 Subject: [PATCH 34/36] The may_alias workaround is also disabled for GCC prior to 3.2. Also added description for this workaround. [SVN r67112] --- include/boost/optional/optional.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index e2e4fcc..2b066e9 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -82,6 +82,15 @@ #define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION #endif +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) > 302 \ + && !defined(__INTEL_COMPILER) +// GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with +// regard to violation of the strict aliasing rules. The optional< T > storage type is marked +// with this attribute in order to let the compiler know that it will alias objects of type T +// and silence compilation warnings. +#define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS +#endif + // Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> // member template of a factory as used in the optional<> implementation. // He proposed this simple fix which is to move the call to apply<> outside @@ -103,12 +112,6 @@ class typed_in_place_factory_base ; namespace optional_detail { -#if defined(__GNUC__) \ - && !(__GNUC__ == 3 && __GNUC_MINOR__ == 2) \ - && !defined(__INTEL_COMPILER) -#define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS -#endif - // This local class is used instead of that in "aligned_storage.hpp" // because I've found the 'official' class to ICE BCB5.5 // when some types are used with optional<> From 646488e0e2f87e5e77d2e764ce642db2304e9ec0 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Dec 2010 11:35:19 +0000 Subject: [PATCH 35/36] operator>> behavior changed slightly so that the stream is not accessed when unrecognized character sequence is detected. [SVN r67184] --- include/boost/optional/optional_io.hpp | 36 +++++---- test/optional_test.cpp | 108 ++++++++++++++++--------- 2 files changed, 88 insertions(+), 56 deletions(-) diff --git a/include/boost/optional/optional_io.hpp b/include/boost/optional/optional_io.hpp index c5d3c31..9e0c807 100644 --- a/include/boost/optional/optional_io.hpp +++ b/include/boost/optional/optional_io.hpp @@ -13,18 +13,19 @@ #define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP #if defined __GNUC__ -# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97) +# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97) # define BOOST_OPTIONAL_NO_TEMPLATED_STREAMS # endif #endif // __GNUC__ #if defined BOOST_OPTIONAL_NO_TEMPLATED_STREAMS # include -#else +#else # include # include -#endif +#endif +#include #include #include "boost/optional/optional.hpp" #include "boost/utility/value_init.hpp" @@ -62,26 +63,29 @@ std::basic_istream& operator>>(std::basic_istream& in, optional& v) #endif { - if ( in.good() ) + if (in.good()) { int d = in.get(); - if ( d == ' ' ) + if (d == ' ') { - T x ; + T x; in >> x; - v = x ; + v = x; } else { - if ( d != '-') - in.setstate( std::ios::failbit ); - - d = in.get(); - - if ( d != '-') - in.setstate( std::ios::failbit ); - - v = optional() ; + if (d == '-') + { + d = in.get(); + + if (d == '-') + { + v = none; + return in; + } + } + + in.setstate( std::ios::failbit ); } } diff --git a/test/optional_test.cpp b/test/optional_test.cpp index e841194..e2e0dd5 100644 --- a/test/optional_test.cpp +++ b/test/optional_test.cpp @@ -158,27 +158,27 @@ void test_basics( T const* ) ob.reset(); check_is_pending_dtor( ARG(T) ) ; check_uninitialized(ob); - + } template void test_conditional_ctor_and_get_valur_or ( T const* ) { TRACE( std::endl << BOOST_CURRENT_FUNCTION ); - + T a(321); - + T z(123); - + optional const cdef0(false,a); - + optional def0(false,a); optional def1 = boost::make_optional(false,a); // T is not within boost so ADL won't find make_optional unqualified check_uninitialized(def0); check_uninitialized(def1); optional const co0(true,a); - + optional o0(true,a); optional o1 = boost::make_optional(true,a); // T is not within boost so ADL won't find make_optional unqualified @@ -186,65 +186,65 @@ void test_conditional_ctor_and_get_valur_or ( T const* ) check_initialized(o1); check_value(o0,a,z); check_value(o1,a,z); - + T b = def0.get_value_or(z); BOOST_CHECK( b == z ) ; - + b = get_optional_value_or(def0,z); BOOST_CHECK( b == z ) ; - + b = o0.get_value_or(z); BOOST_CHECK( b == a ) ; b = get_optional_value_or(o0,z); BOOST_CHECK( b == a ) ; - - + + T const& crz = z ; T& rz = z ; - + T const& crzz = def0.get_value_or(crz); BOOST_CHECK( crzz == crz ) ; - + T& rzz = def0.get_value_or(rz); BOOST_CHECK( rzz == rz ) ; - + T const& crzzz = get_optional_value_or(cdef0,crz); BOOST_CHECK( crzzz == crz ) ; - + T& rzzz = get_optional_value_or(def0,rz); BOOST_CHECK( rzzz == rz ) ; - + T const& crb = o0.get_value_or(crz); BOOST_CHECK( crb == a ) ; - + T& rb = o0.get_value_or(rz); BOOST_CHECK( rb == b ) ; - + T const& crbb = get_optional_value_or(co0,crz); BOOST_CHECK( crbb == b ) ; - + T const& crbbb = get_optional_value_or(o0,crz); BOOST_CHECK( crbbb == b ) ; - + T& rbb = get_optional_value_or(o0,rz); BOOST_CHECK( rbb == b ) ; - + T& ra = a ; - + optional defref(false,ra); BOOST_CHECK(!defref); - + optional ref(true,ra); BOOST_CHECK(!!ref); - + a = T(432); - + BOOST_CHECK( *ref == a ) ; - + T& r1 = defref.get_value_or(z); BOOST_CHECK( r1 == z ) ; - + T& r2 = ref.get_value_or(z); BOOST_CHECK( r2 == a ) ; } @@ -718,7 +718,7 @@ void test_relops( T const* ) optional opt0(v0); optional opt1(v1); optional opt2(v2); - + // Check identity BOOST_CHECK ( def0 == def0 ) ; BOOST_CHECK ( opt0 == opt0 ) ; @@ -756,7 +756,7 @@ void test_relops( T const* ) BOOST_CHECK ( opt1 > opt0 ) ; BOOST_CHECK ( opt1 <= opt2 ) ; BOOST_CHECK ( opt1 >= opt0 ) ; - + // Compare against a value directly BOOST_CHECK ( opt0 == v0 ) ; BOOST_CHECK ( opt0 != v1 ) ; @@ -799,7 +799,7 @@ void test_none( T const* ) BOOST_CHECK ( def0 == none ) ; BOOST_CHECK ( non_def != none ) ; BOOST_CHECK ( !def1 ) ; - BOOST_CHECK ( !(non_def < none) ) ; + BOOST_CHECK ( !(non_def < none) ) ; BOOST_CHECK ( non_def > none ) ; BOOST_CHECK ( !(non_def <= none) ) ; BOOST_CHECK ( non_def >= none ) ; @@ -819,11 +819,11 @@ void test_arrow( T const* ) optional oa(a) ; optional const coa(a) ; - + BOOST_CHECK ( coa->V() == 1234 ) ; - + oa->V() = 4321 ; - + BOOST_CHECK ( a.V() = 1234 ) ; BOOST_CHECK ( (*oa).V() = 4321 ) ; } @@ -1086,7 +1086,7 @@ namespace optional_swap_test x = boost::in_place('\0'); else if ( !hasY ) y = boost::in_place('\0'); - + optional_swap_test::swap(*x,*y); if( !hasX ) @@ -1118,7 +1118,7 @@ template struct optional_swap_should_use_default_constructor< // // Specialization of boost::swap: // -template <> +template <> void swap(optional & x, optional & y) { optional_swap_test::swap(x, y); @@ -1133,25 +1133,25 @@ namespace std { // Specializations of std::swap: // -template <> +template <> void swap(optional_swap_test::class_whose_default_ctor_should_be_used & x, optional_swap_test::class_whose_default_ctor_should_be_used & y) { optional_swap_test::swap(x, y); } -template <> +template <> void swap(optional_swap_test::class_whose_default_ctor_should_not_be_used & x, optional_swap_test::class_whose_default_ctor_should_not_be_used & y) { optional_swap_test::swap(x, y); } -template <> +template <> void swap(optional_swap_test::class_without_default_ctor & x, optional_swap_test::class_without_default_ctor & y) { optional_swap_test::swap(x, y); } -template <> +template <> void swap(optional_swap_test::class_whose_explicit_ctor_should_be_used & x, optional_swap_test::class_whose_explicit_ctor_should_be_used & y) { optional_swap_test::swap(x, y); @@ -1204,7 +1204,7 @@ bool test_swap_function( T const* ) // // Tests whether the optional::swap member function works properly. -// Assumes that T has one data member, of type char. +// Assumes that T has one data member, of type char. // Returns true iff the test is passed. // template @@ -1263,6 +1263,33 @@ void test_swap_tweaking() BOOST_CHECK( test_swap_member_function( ARG(optional_swap_test::template_whose_default_ctor_should_be_used) ) ); } +// Test for support for classes with overridden operator& +class CustomAddressOfClass +{ + int n; + +public: + CustomAddressOfClass() : n(0) {} + CustomAddressOfClass(CustomAddressOfClass const& that) : n(that.n) {} + explicit CustomAddressOfClass(int m) : n(m) {} + int* operator& () { return &n; } + bool operator== (CustomAddressOfClass const& that) const { return n == that.n; } +}; + +void test_custom_addressof_operator() +{ + boost::optional< CustomAddressOfClass > o1(CustomAddressOfClass(10)); + BOOST_CHECK(!!o1); + BOOST_CHECK(o1.get() == CustomAddressOfClass(10)); + + o1 = CustomAddressOfClass(20); + BOOST_CHECK(!!o1); + BOOST_CHECK(o1.get() == CustomAddressOfClass(20)); + + o1 = boost::none; + BOOST_CHECK(!o1); +} + int test_main( int, char* [] ) { try @@ -1273,6 +1300,7 @@ int test_main( int, char* [] ) test_conversions1(); test_conversions2(); test_swap_tweaking(); + test_custom_addressof_operator(); } catch ( ... ) { From e9989b260e0e4acd02a839ac95904746fe9922d2 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 17 Dec 2010 21:12:56 +0000 Subject: [PATCH 36/36] Refs #4987. Added forward declaration of namespace-scope swap for boost::optional, this should fix GCC compilation errors. Also swap implementation now uses Boost.Utility.Swap to make use of the workarounds for some broken compilers. If it breaks for your compiler, let me know in the mentioned ticket. [SVN r67288] --- include/boost/optional/optional.hpp | 143 +++++++++++++--------------- 1 file changed, 65 insertions(+), 78 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 2b066e9..ec9006e 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -18,24 +18,25 @@ #include #include -#include "boost/config.hpp" -#include "boost/assert.hpp" -#include "boost/type.hpp" -#include "boost/type_traits/alignment_of.hpp" -#include "boost/type_traits/has_nothrow_constructor.hpp" -#include "boost/type_traits/type_with_alignment.hpp" -#include "boost/type_traits/remove_reference.hpp" -#include "boost/type_traits/is_reference.hpp" -#include "boost/mpl/if.hpp" -#include "boost/mpl/bool.hpp" -#include "boost/mpl/not.hpp" -#include "boost/detail/reference_content.hpp" -#include "boost/none.hpp" -#include "boost/utility/addressof.hpp" -#include "boost/utility/compare_pointees.hpp" -#include "boost/utility/in_place_factory.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include "boost/optional/optional_fwd.hpp" +#include #if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // VC6.0 has the following bug: @@ -98,7 +99,7 @@ namespace boost_optional_detail { template - void construct(Factory const& factory, void* address) + inline void construct(Factory const& factory, void* address) { factory.BOOST_NESTED_TEMPLATE apply(address); } @@ -110,6 +111,9 @@ namespace boost { class in_place_factory_base ; class typed_in_place_factory_base ; +// This forward is needed to refer to namespace scope swap from the member swap +template void swap ( optional& x, optional& y ); + namespace optional_detail { // This local class is used instead of that in "aligned_storage.hpp" @@ -615,7 +619,7 @@ class optional : public optional_detail::optional_base void swap( optional & arg ) { // allow for Koenig lookup - using boost::swap ; + using boost::swap; swap(*this, arg); } @@ -914,79 +918,63 @@ inline bool operator >= ( none_t x, optional const& y ) { return !( x < y ) ; } -// -// The following swap implementation follows the GCC workaround as found in -// "boost/detail/compressed_pair.hpp" -// namespace optional_detail { -// GCC < 3.2 gets the using declaration at namespace scope (FLC, DWA) -#if BOOST_WORKAROUND(__GNUC__, < 3) \ - || BOOST_WORKAROUND(__GNUC__, == 3) && __GNUC_MINOR__ <= 2 - using std::swap; -#define BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE -#endif +template struct swap_selector; - template struct swap_selector; - - template<> - struct swap_selector - { +template<> +struct swap_selector +{ template static void optional_swap ( optional& x, optional& y ) { - bool hasX = x; - bool hasY = y; + const bool hasX = !!x; + const bool hasY = !!y; - if ( !hasX && !hasY ) - return; + if ( !hasX && !hasY ) + return; - if( !hasX ) - x = boost::in_place(); - else if ( !hasY ) - y = boost::in_place(); + if( !hasX ) + x = boost::in_place(); + else if ( !hasY ) + y = boost::in_place(); - // GCC > 3.2 and all other compilers have the using declaration at function scope (FLC) -#ifndef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE - // allow for Koenig lookup - using std::swap ; -#endif - swap(*x,*y); + // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers + boost::swap(x.get(),y.get()); - if( !hasX ) - y = boost::none ; - else if( !hasY ) - x = boost::none ; + if( !hasX ) + y = boost::none ; + else if( !hasY ) + x = boost::none ; } - }; +}; - template<> - struct swap_selector - { +template<> +struct swap_selector +{ template static void optional_swap ( optional& x, optional& y ) { - if ( !x && !!y ) - { - x = *y; - y = boost::none ; - } - else if ( !!x && !y ) - { - y = *x ; - x = boost::none ; - } - else if ( !!x && !!y ) - { - // GCC > 3.2 and all other compilers have the using declaration at function scope (FLC) - #ifndef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE - // allow for Koenig lookup - using std::swap ; - #endif - swap(*x,*y); - } + const bool hasX = !!x; + const bool hasY = !!y; + + if ( !hasX && hasY ) + { + x = y.get(); + y = boost::none ; + } + else if ( hasX && !hasY ) + { + y = x.get(); + x = boost::none ; + } + else if ( hasX && hasY ) + { + // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers + boost::swap(x.get(),y.get()); + } } - }; +}; } // namespace optional_detail @@ -995,10 +983,9 @@ struct optional_swap_should_use_default_constructor : has_nothrow_default_constr template inline void swap ( optional& x, optional& y ) { - optional_detail::swap_selector::value>::optional_swap(x, y); + optional_detail::swap_selector::value>::optional_swap(x, y); } } // namespace boost #endif -