Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2023. The current version is 1.90.0.
std::hash<boost::optional<T>>.
This fixes issue
#55. You may get compiler errors when your program provides specializations
for std::hash<boost::optional<T>>.
If this happens, define macro BOOST_OPTIONAL_CONFIG_DO_NOT_SPECIALIZE_STD_HASH
to suppress the specializations of std::hash
in this library.
boost::none is constexpr-declared.
boost::none is now declared as an inline variable
(on compilers that support it): there is only one instance of boost::none across all translation units.
optional<T> for trivial Ts.
Thanks to Robert Leahy for the fix. For details see pr
#78.
-Wweak-vtables.
has_value() for compatibility with std::optional (issue
#52).
map() for transforming optional<T> into optional<U> using a function of type T -> U.
flat_map() for transforming optional<T> into optional<U> using a function of type T -> optional<U>.
-Wzero-as-null-pointer-constant warnings.
optional
is now trivially-copyable for scalar Ts.
This uses a different storage (just T
rather than aligned_storage).
We require the compiler to support defaulted functions.
operator== to get rid of the -Wmaybe-uninitialized false-positive warning
from GCC.
emplace()
functions: they initialize the contained value by perfect-forwarding the
obtained arguments. One constructor always initializes the contained value,
the other based on a boolean condition.
o =
{} now correctly un-initializes
optional, just like in std::optional.
boost::optional is specialized for reference
parameters. This addresses a couple of issues:
sizeof of optional
reference is that of a pointer,
<type_traits>.
boost::none
again. Now it is a const object with internal linkage (as any other tag).
This fixes Trac
#11203.
emplace(),
and therewith removed the dependency on <boost/utility/in_place_factory.hpp>.
boost::none_t is no longer convertible from
literal 0. This avoids a bug
where optional<rational<int>> oi = 0; would
initialize an optional object with no contained value.
optional
without header optional_io.hpp
by using safe-bool idiom. This addresses Trac
#10825.
BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES.
This can be used to work around Trac
#10399.
optional<U> to optional<T> when U
is not assignable or convertible to T
(Trac #11087).
optional<T&> (Trac
#10839).
<string>
to fix C++03 compile error on logic_error("...")".
optional<T> works with moveable but non-copyable
T's,
swap (now uses
move operations),
emplace(). This is the last of the requests from
Trac #1841,
optional is moveable, including
conditional noexcept specifications,
which make it move_if_noexcept-friendly,
operator<<(ostream&, optional
const&)
to prevent inadvertent incorrect serialization of optional objects,
reset() from examples (Trac
#9005),
boost::none
does not require that T
be EqualityComparable,
value(), value_or(), value_or_eval(),