BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslma::ConstructionUtil_Imp Struct Reference

#include <bslma_constructionutil.h>

Public Types

enum  { e_NIL_TRAITS , e_BITWISE_MOVABLE_TRAITS , e_USES_ALLOCATOR_TRAITS , e_USES_ALLOCATOR_ARG_T_TRAITS }
 

Static Public Member Functions

template<class TARGET_TYPE , class ALLOCATOR >
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_USES_ALLOCATOR_ARG_T_TRAITS >)
 
template<class TARGET_TYPE , class ALLOCATOR >
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_USES_ALLOCATOR_TRAITS >)
 
template<class TARGET_TYPE , class ALLOCATOR >
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_NIL_TRAITS >)
 
template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_USES_ALLOCATOR_ARG_T_TRAITS >, ARG1 &argument1, ARGS &&... arguments)
 
template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_USES_ALLOCATOR_TRAITS >, ARG1 &argument1, ARGS &&... arguments)
 
template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_NIL_TRAITS >, ARG1 &argument1, ARGS &&... arguments)
 
template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_USES_ALLOCATOR_ARG_T_TRAITS >, BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) argument1, ARGS &&... arguments)
 
template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_USES_ALLOCATOR_TRAITS >, BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) argument1, ARGS &&... arguments)
 
template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
static void construct (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_NIL_TRAITS >, BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) argument1, ARGS &&... arguments)
 
template<class TARGET_TYPE , class ALLOCATOR >
static void destructiveMove (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_BITWISE_MOVABLE_TRAITS >, TARGET_TYPE *original)
 
template<class TARGET_TYPE , class ALLOCATOR >
static void destructiveMove (TARGET_TYPE *address, const ALLOCATOR &allocator, bsl::integral_constant< int, e_NIL_TRAITS >, TARGET_TYPE *original)
 
template<class TARGET_TYPE >
static void * voidify (TARGET_TYPE *address)
 

Detailed Description

This struct provides a namespace for a suite of utility functions that are used to implement functions in ConstructionUtil. In particular, they provide overloads, resolved at compile-time, for various features (e.g., passing down the allocator to sub-elements of pair-like types) and optimizations (e.g., bypassing the call to the constructor for classes with trivial default and copy constructors). These functions should not be used outside this component.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

These constants are used in the overloads below, when the last argument is of type bsl::integral_constant<int, N> *, indicating that TARGET_TYPE has the traits for which the enumerator equal to N is named.

Enumerator
e_NIL_TRAITS 
e_BITWISE_MOVABLE_TRAITS 
e_USES_ALLOCATOR_TRAITS 
e_USES_ALLOCATOR_ARG_T_TRAITS 

Member Function Documentation

◆ construct() [1/9]

template<class TARGET_TYPE , class ALLOCATOR >
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_NIL_TRAITS  
)
inlinestatic

◆ construct() [2/9]

template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_NIL_TRAITS ,
ARG1 &  argument1,
ARGS &&...  arguments 
)
inlinestatic

◆ construct() [3/9]

template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_NIL_TRAITS ,
BSLS_COMPILERFEATURES_FORWARD_REF(ARG1)  argument1,
ARGS &&...  arguments 
)
inlinestatic

◆ construct() [4/9]

template<class TARGET_TYPE , class ALLOCATOR >
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_USES_ALLOCATOR_ARG_T_TRAITS  
)
inlinestatic

Construct a default instance of (template parameter) TARGET_TYPE at the specified address, passing to the constructor the specified allocator using the leading or trailing allocator convention, according to the specified integral_constant tag, or ignoring allocator in the e_NIL_TRAITS case. If the constructor throws, the memory at address is left in an unspecified state.

◆ construct() [5/9]

template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_USES_ALLOCATOR_ARG_T_TRAITS ,
ARG1 &  argument1,
ARGS &&...  arguments 
)
inlinestatic

◆ construct() [6/9]

template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_USES_ALLOCATOR_ARG_T_TRAITS ,
BSLS_COMPILERFEATURES_FORWARD_REF(ARG1)  argument1,
ARGS &&...  arguments 
)
inlinestatic

Construct an instance of (template parameter) TARGET_TYPE at the specified address forwarding to the constructor the specified argument1 and arguments arguments and passing the specified allocator using the leading or trailing allocator convention, according to the specified integral_constant tag, or ignoring allocator in the e_NIL_TRAITS case. If the constructor throws, the memory at address is left in an unspecified state.

◆ construct() [7/9]

template<class TARGET_TYPE , class ALLOCATOR >
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_USES_ALLOCATOR_TRAITS  
)
inlinestatic

◆ construct() [8/9]

template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_USES_ALLOCATOR_TRAITS ,
ARG1 &  argument1,
ARGS &&...  arguments 
)
inlinestatic

◆ construct() [9/9]

template<class TARGET_TYPE , class ALLOCATOR , class ARG1 , class... ARGS>
void bslma::ConstructionUtil_Imp::construct ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_USES_ALLOCATOR_TRAITS ,
BSLS_COMPILERFEATURES_FORWARD_REF(ARG1)  argument1,
ARGS &&...  arguments 
)
inlinestatic

◆ destructiveMove() [1/2]

template<class TARGET_TYPE , class ALLOCATOR >
void bslma::ConstructionUtil_Imp::destructiveMove ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_BITWISE_MOVABLE_TRAITS ,
TARGET_TYPE *  original 
)
inlinestatic

Move the bitwise movable object of (template parameter) TARGET_TYPE at the specified original address to the specified address, eliding the call to the move constructor and destructor in favor of performing a bitwise copy. The specified allocator argument is ignored (except possibly for precondition checks). The behavior is undefined if original uses an allocator other than allocator to supply memory.

◆ destructiveMove() [2/2]

template<class TARGET_TYPE , class ALLOCATOR >
void bslma::ConstructionUtil_Imp::destructiveMove ( TARGET_TYPE *  address,
const ALLOCATOR &  allocator,
bsl::integral_constant< int, e_NIL_TRAITS ,
TARGET_TYPE *  original 
)
inlinestatic

Create an object of (template parameter) TARGET_TYPE at the specified address by move construction from the specified original object, then destroy original. The specified allocator is unused (except possibly in precondition checks). The constructed object will have the same allocator (if any) as original. If the move constructor throws an exception, the memory at address is left in an uninitialized state and original is left in a valid but unspecified state. The behavior is undefined if original uses an allocator other than allocator to supply memory. Note that, if original points to an object of a type derived from TARGET_TYPE (i.e., a slicing move) where TARGET_TYPE has a non-virtual destructor, then original will be only partially destroyed.

◆ voidify()

template<class TARGET_TYPE >
void * bslma::ConstructionUtil_Imp::voidify ( TARGET_TYPE *  address)
inlinestatic

Return the specified address cast as a pointer to void, even if the (template parameter) TARGET_TYPE is cv-qualified.


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