8#ifndef INCLUDED_BDLMA_LOCALBUFFEREDOBJECT
9#define INCLUDED_BDLMA_LOCALBUFFEREDOBJECT
201#include <bdlscm_version.h>
217#include <bsl_type_traits.h>
219#ifdef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
220# include <initializer_list>
223#include <bsl_cstddef.h>
224#include <bsl_utility.h>
226#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
230# define COMPILING_BDLMA_LOCALBUFFEREDOBJECT_H
232# undef COMPILING_BDLMA_LOCALBUFFEREDOBJECT_H
235#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
236#define BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(DST, SRC) \
237 std::is_assignable<DST, SRC>::value
239#define BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(DST, SRC) true
258template <
class t_TYPE,
259 bsl::size_t t_BUFFER_SIZE = 1024,
260 bool t_DISABLE_DESTRUCTION =
false>
289 void destroyHeldObject();
294 BloombergLP::bslmf::UsesAllocatorArgT);
297#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
303 template <
class... ARGS>
312 template <
class... ARGS>
318#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
324 template <
class INIT_LIST_TYPE>
332 template <
class INIT_LIST_TYPE>
335 std::initializer_list<INIT_LIST_TYPE> il);
346#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
348 template <
class t_ANY_TYPE>
364#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
369 template <
class... ARGS>
373#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
378 template <
class INIT_LIST_TYPE>
379 void emplace(std::initializer_list<INIT_LIST_TYPE> il);
408template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
413 if (!t_DISABLE_DESTRUCTION) {
414 d_object.
address()->~value_type();
419#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
420template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
421template <
class... ARGS>
433template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
434template <
class... ARGS>
440: d_arenaAllocator(
bslma::AllocatorUtil::adapt(allocator))
449#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
450template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
451template <
class INIT_LIST_TYPE>
463template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
464template <
class INIT_LIST_TYPE>
466LocalBufferedObject<t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION>::
467 LocalBufferedObject(bsl::allocator_arg_t ,
469 std::initializer_list<INIT_LIST_TYPE> il)
470: d_arenaAllocator(
bslma::AllocatorUtil::adapt(allocator))
479template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
488#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
490template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
491template <
class t_ANY_TYPE>
506template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
514template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
522#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
523template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
524template <
class... ARGS>
537#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
538template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
539template <
class INIT_LIST_TYPE>
541 emplace(std::initializer_list<INIT_LIST_TYPE> il)
553template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
562template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
571template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
580#undef BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE
bslma::Allocator * allocator() const
Return the allocator passed at construction.
Definition bdlma_bufferedsequentialallocator.h:531
void release() BSLS_KEYWORD_OVERRIDE
Definition bdlma_bufferedsequentialallocator.h:518
Definition bdlma_localbufferedobject.h:261
BSLMF_NESTED_TRAIT_DECLARATION(LocalBufferedObject, BloombergLP::bslmf::UsesAllocatorArgT)
t_TYPE value_type
Definition bdlma_localbufferedobject.h:267
value_type & operator*()
Definition bdlma_localbufferedobject.h:517
~LocalBufferedObject()
Definition bdlma_localbufferedobject.h:482
allocator_type get_allocator() const
Definition bdlma_localbufferedobject.h:575
value_type * operator->()
Definition bdlma_localbufferedobject.h:509
void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
Definition bdlma_localbufferedobject.h:526
bsl::allocator allocator_type
Definition bdlma_localbufferedobject.h:268
LocalBufferedObject(bsl::allocator_arg_t, allocator_type allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
@ k_BUFFER_SIZE
Definition bdlma_localbufferedobject.h:270
Definition bdlma_localsequentialallocator.h:230
Definition bslma_bslallocator.h:580
#define BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(DST, SRC)
Definition bdlma_localbufferedobject.h:236
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:609
Definition bdlma_alignedallocator.h:276
Definition balxml_encoderoptions.h:68
Definition bslmf_enableif.h:525
static bsl::enable_if<!IsDerivedFromBslAllocator< t_ALLOC >::value, t_ALLOC >::type adapt(const t_ALLOC &from)
Definition bslma_allocatorutil.h:856
static void construct(TARGET_TYPE *address, const ALLOCATOR &allocator)
Definition bslma_constructionutil.h:1243
Definition bslma_usesbslmaallocator.h:343
Definition bsls_objectbuffer.h:276
TYPE * address()
Definition bsls_objectbuffer.h:334
TYPE & object()
Definition bsls_objectbuffer.h:351