BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl::Optional_DataImp< t_TYPE > Struct Template Reference

#include <bslstl_optional.h>

Inheritance diagram for bslstl::Optional_DataImp< t_TYPE >:
bslstl::Optional_Data< t_TYPE, t_IS_TRIVIALLY_DESTRUCTIBLE > bslstl::Optional_Data< t_TYPE, true >

Public Member Functions

 Optional_DataImp () BSLS_KEYWORD_NOEXCEPT
 Create an empty Optional_DataImp object.
 
template<class... t_ARGS>
t_TYPE & emplace (bslma::Allocator *allocator, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
 
void reset () BSLS_KEYWORD_NOEXCEPT
 Destroy the value_type object in d_buffer, if any.
 
t_TYPE & value ()
 
bool hasValue () const BSLS_KEYWORD_NOEXCEPT
 Return true if this objects has a value, and false otherwise.
 
const t_TYPE & value () const
 

Detailed Description

template<class t_TYPE>
struct bslstl::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.

Constructor & Destructor Documentation

◆ Optional_DataImp()

template<class t_TYPE >
bslstl::Optional_DataImp< t_TYPE >::Optional_DataImp ( )

Member Function Documentation

◆ emplace()

template<class t_TYPE >
template<class... t_ARGS>
t_TYPE & bslstl::Optional_DataImp< t_TYPE >::emplace ( bslma::Allocator allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...  args 
)
inline

Create an object of StoredType in d_buffer using the specified allocator and args and return a reference providing modifiable access to the underlying t_TYPE object.

◆ hasValue()

template<class t_TYPE >
bool bslstl::Optional_DataImp< t_TYPE >::hasValue ( ) const
inline

◆ reset()

template<class t_TYPE >
void bslstl::Optional_DataImp< t_TYPE >::reset ( )

◆ value() [1/2]

template<class t_TYPE >
t_TYPE & bslstl::Optional_DataImp< t_TYPE >::value ( )
inline

◆ value() [2/2]

template<class t_TYPE >
const t_TYPE & bslstl::Optional_DataImp< t_TYPE >::value ( ) const
inline

The documentation for this struct was generated from the following file: