8#ifndef INCLUDED_BDLMA_LOCALBUFFEREDOBJECT
9#define INCLUDED_BDLMA_LOCALBUFFEREDOBJECT
201#include <bdlscm_version.h>
219#include <bsl_type_traits.h>
221#ifdef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
222# include <initializer_list>
225#include <bsl_cstddef.h>
226#include <bsl_utility.h>
228#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
234# define COMPILING_BDLMA_LOCALBUFFEREDOBJECT_H
236# undef COMPILING_BDLMA_LOCALBUFFEREDOBJECT_H
241#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
242#define BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(DST, SRC) \
243 std::is_assignable<DST, SRC>::value
245#define BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(DST, SRC) true
264template <
class t_TYPE,
265 bsl::size_t t_BUFFER_SIZE = 1024,
266 bool t_DISABLE_DESTRUCTION =
false>
295 void destroyHeldObject();
300 BloombergLP::bslmf::UsesAllocatorArgT);
303#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
309 template <
class... ARGS>
318 template <
class... ARGS>
324#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
330 template <
class INIT_LIST_TYPE>
338 template <
class INIT_LIST_TYPE>
341 std::initializer_list<INIT_LIST_TYPE> il);
352#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
354 template <
class t_ANY_TYPE>
370#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
375 template <
class... ARGS>
379#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
384 template <
class INIT_LIST_TYPE>
385 void emplace(std::initializer_list<INIT_LIST_TYPE> il);
415template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
420 if (!t_DISABLE_DESTRUCTION) {
421 d_object.
address()->~value_type();
426#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
427template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
428template <
class... ARGS>
440template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
441template <
class... ARGS>
447: d_arenaAllocator(
bslma::AllocatorUtil::adapt(allocator))
456#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
457template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
458template <
class INIT_LIST_TYPE>
470template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
471template <
class INIT_LIST_TYPE>
473LocalBufferedObject<t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION>::
476 std::initializer_list<INIT_LIST_TYPE> il)
477: d_arenaAllocator(
bslma::AllocatorUtil::adapt(allocator))
486template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
495#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
497template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
498template <
class t_ANY_TYPE>
513template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
521template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
529#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
530template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
531template <
class... ARGS>
544#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
545template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
546template <
class INIT_LIST_TYPE>
548 emplace(std::initializer_list<INIT_LIST_TYPE> il)
560template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
569template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
578template <
class t_TYPE, bsl::
size_t t_BUFFER_SIZE,
bool t_DISABLE_DESTRUCTION>
587#undef BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE
bslma::Allocator * allocator() const
Return the allocator passed at construction.
Definition bdlma_bufferedsequentialallocator.h:537
void release() BSLS_KEYWORD_OVERRIDE
Definition bdlma_bufferedsequentialallocator.h:524
Definition bdlma_localbufferedobject.h:267
BSLMF_NESTED_TRAIT_DECLARATION(LocalBufferedObject, BloombergLP::bslmf::UsesAllocatorArgT)
t_TYPE value_type
Definition bdlma_localbufferedobject.h:273
value_type & operator*()
Definition bdlma_localbufferedobject.h:524
~LocalBufferedObject()
Definition bdlma_localbufferedobject.h:489
@ k_BUFFER_SIZE
Definition bdlma_localbufferedobject.h:276
allocator_type get_allocator() const
Definition bdlma_localbufferedobject.h:582
value_type * operator->()
Definition bdlma_localbufferedobject.h:516
void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
Definition bdlma_localbufferedobject.h:533
bsl::allocator allocator_type
Definition bdlma_localbufferedobject.h:274
LocalBufferedObject(bsl::allocator_arg_t, allocator_type allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
Definition bdlma_localsequentialallocator.h:230
Definition bslma_bslallocator.h:588
#define BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(DST, SRC)
Definition bdlma_localbufferedobject.h:245
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:231
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:651
Definition bdlma_alignedallocator.h:278
Definition baljsn_encoder_testtypes.h:76
Definition bslmf_allocatorargt.h:433
Definition bslmf_enableif.h:530
static bsl::enable_if<!IsDerivedFromBslAllocator< t_ALLOC >::value, t_ALLOC >::type adapt(const t_ALLOC &from)
Definition bslma_allocatorutil.h:871
static void construct(TARGET_TYPE *address, const ALLOCATOR &allocator)
Definition bslma_constructionutil.h:1244
Definition bslma_usesbslmaallocator.h:344
Definition bsls_objectbuffer.h:277
TYPE * address()
Definition bsls_objectbuffer.h:335
TYPE & object()
Definition bsls_objectbuffer.h:352