Fix: prevented the binding illegal temporary to optional<const int&>

Older MSVC versions add illegal temporary when you want to assign from const integral value.
This commit is contained in:
Andrzej Krzemienski
2016-02-18 23:18:01 +01:00
parent 1671966380
commit 44d57a1d8b
20 changed files with 161 additions and 109 deletions

View File

@@ -1,6 +1,8 @@

[section Optional references]
[section Overview]
This library allows the template parameter `T` to be of reference type:
`T&`, and to some extent, `T const&`.
@@ -21,7 +23,7 @@ will nonetheless refer to the same object.
* Value-access will actually provide access to the referenced object
rather than the reference itself.
[warning On compilers that do not conform to Standard C++ rules of reference binding, operations on optional references might give adverse results: rather than binding a reference to a designated object they may create an unexpected temporary and bind to it. For more details see [link boost_optional.dependencies_and_portability.optional_reference_binding Dependencies and Portability section].]
[caution On compilers that do not conform to Standard C++ rules of reference binding, some operations on optional references are disabled in order to prevent subtle bugs. For more details see [link boost_optional.dependencies_and_portability.optional_reference_binding Dependencies and Portability section].]
[heading Rvalue references]
@@ -118,3 +120,4 @@ In such a scenario, you can assign the value itself directly, as in:
*opt=value;
[endsect]
[endsect]