BloombergLP::bslstl::Optional_Data

This component-private struct manages a value_type object in Optional_Base by inheriting from Optional_DataImp. In addition, this primary template properly destroys the owned instance of t_TYPE in its destructor.

Synopsis

Declared in <bslstl_optional.h>

template<
    class t_TYPE,
    bool t_IS_TRIVIALLY_DESTRUCTIBLE = bslstl::Optional_IsTriviallyDestructible<t_TYPE>::value>
struct Optional_Data
    : Optional_DataImp<t_TYPE>

Base Classes

NameDescription
Optional_DataImp<t_TYPE>This component-private struct manages a value_type object in an Optional_Base object. This class provides an abstraction for const value type. An Optional_Base object may contain an object of const type. An assignment to such an Optional_Base object should not succeed. However, unless the Optional_Base object itself is const, it should be possible to change the value of the Optional_Base object using emplace. In order to allow for that, this class manages a non-const object of value_type, but all the accessors return a const adjusted reference to the managed object.

Member Functions

NameDescription
~Optional_Data [destructor]Destroy the managed value_type object, if it exists.
emplace emplace overloads
hasValue Return true if this objects has a value, and false otherwise.
reset Destroy the value_type object in d_buffer, if any.
value value overloads

Using Declarations

Name
Unnamed using

Specializations

NameDescription
Optional_Data<t_TYPE, true> This partial specialization manages a trivially destructible value_type in Optional_Base. It does not have a user-provided destructor, which makes it is_trivially_destructible itself.