- lib:
boost/libs/optional
- repo:
boostorg/optional
- commit:
cb7641dc
, 2017-02-14
Header <boost/optional.hpp>
Header <boost/optional/optional_io.hpp>
Allow bind to reference type (but not rvalue-reference)
Differences from STD proposal:
- Supports bind to lvalue-reference, specialized for reference and storing pointer for them.
- Constructor
optional(bool, T const&)
andmake_optional(bool, T const&)
- Constructors/assignments for
optional<U>
, whenT
can construct fromU
- Constructors/assignments for InPlaceFactory, and
in_place_init_if_t
constructors. - Member and non-member
get()
andget_ptr()
, to get reference/pointer to stored data. - Provide
value_or_eval(F)
boost::none
vs.std::nullopt
Thrown by optional::value()
when it contains nothing.
- Empty
optional
becomes"--"
. - Non-empty
optional
having a leading space and the content value's representation.
<boost/config.hpp>
,<boost/detail/workaround.hpp>
<boost/core/addressof.hpp>
<boost/core/enable_if.hpp>
<boost/core/explicit_operator_bool.hpp>
<boost/core/swap.hpp>
<boost/type.hpp>
<boost/assert.hpp>
<boost/static_assert.hpp>
<boost/throw_exception.hpp>
<boost/mpl/if.hpp>
,<boost/mpl/bool.hpp>
,<boost/mpl/not.hpp>
<boost/type_traits/alignment_of.hpp>
,<boost/type_traits/type_with_alignment.hpp>
<boost/type_traits/*.hpp>
for const/reference, decay, etc.<boost/type_traits/*.hpp>
for nothrow_xxx detection<boost/type_traits/is_same.hpp>
,<boost/type_traits/is_base_of.hpp>
<boost/move/utility.hpp>
<boost/utility/compare_pointees.hpp>
Standard library: <optional>
(C++17)
Proposals:
Library Fundamentals v1 - <optional>