Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

bslstl::Optional_DataImp< TYPE > Struct Template Reference

#include <bslstl_optional.h>

Inheritance diagram for bslstl::Optional_DataImp< TYPE >:
bslstl::Optional_Data< TYPE, IS_TRIVIALLY_DESTRUCTIBLE > bslstl::Optional_Data< TYPE, true >

List of all members.

Public Member Functions

 Optional_DataImp () BSLS_KEYWORD_NOEXCEPT
template<class... ARGS>
TYPE & emplace (bslma::Allocator *allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)...)
template<class INIT_LIST_TYPE , class... ARGS>
TYPE & emplace (bslma::Allocator *allocator, std::initializer_list< INIT_LIST_TYPE > initializer_list, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)...)
void reset () BSLS_KEYWORD_NOEXCEPT
TYPE & value ()
bool hasValue () const BSLS_KEYWORD_NOEXCEPT
const TYPE & value () const

Detailed Description

template<class TYPE>
struct bslstl::Optional_DataImp< TYPE >

This component-private struct manages a value_type object in an optional object. This class provides an abstraction for const value type. An optional object may contain an object of const type. An assignment to such an optional object should not succeed. However, unless the optional object itself is const, it should be possible to change the value of the optional 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.

See Component bslstl_optional


Constructor & Destructor Documentation

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

Create an empty Optional_DataImp object.


Member Function Documentation

template<class TYPE >
template<class... ARGS>
TYPE& bslstl::Optional_DataImp< TYPE >::emplace ( bslma::Allocator allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)  ... 
)

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

template<class TYPE >
template<class INIT_LIST_TYPE , class... ARGS>
TYPE& bslstl::Optional_DataImp< TYPE >::emplace ( bslma::Allocator allocator,
std::initializer_list< INIT_LIST_TYPE >  initializer_list,
BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)  ... 
)

Create an object of StoredType in d_buffer using the specified allocator, initializer_list and arguments, and return a reference providing modifiable access to the underlying TYPE object.

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

Destroy the value_type object in d_buffer, if any.

template<class TYPE >
TYPE& bslstl::Optional_DataImp< TYPE >::value (  ) 

Return the value_type object in d_buffer with const qualification adjusted to match that of TYPE. The behavior is undefined unless this->hasValue() == true.

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

Return true if this objects has a value, and false otherwise.

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

Return the value_type object in d_buffer with const qualification adjusted to match that of TYPE. The behavior is undefined unless this->hasValue() == true.


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