BDE 4.14.0 Production release
|
#include <bslalg_arrayprimitives.h>
Public Types | |
typedef ArrayPrimitives_Imp | Imp |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
Static Public Member Functions | |
template<class ALLOCATOR , class FWD_ITER > | |
static void | copyConstruct (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, FWD_ITER fromBegin, FWD_ITER fromEnd, ALLOCATOR allocator) |
template<class ALLOCATOR , class SOURCE_TYPE > | |
static void | copyConstruct (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, SOURCE_TYPE *fromBegin, SOURCE_TYPE *fromEnd, ALLOCATOR allocator) |
template<class TARGET_TYPE , class FWD_ITER > | |
static void | copyConstruct (TARGET_TYPE *toBegin, FWD_ITER fromBegin, FWD_ITER fromEnd, bslma::Allocator *allocator) |
template<class TARGET_TYPE , class SOURCE_TYPE > | |
static void | copyConstruct (TARGET_TYPE *toBegin, SOURCE_TYPE *fromBegin, SOURCE_TYPE *fromEnd, bslma::Allocator *allocator) |
template<class ALLOCATOR > | |
static void | moveConstruct (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | moveConstruct (TARGET_TYPE *toBegin, TARGET_TYPE *fromBegin, TARGET_TYPE *fromEnd, bslma::Allocator *allocator) |
template<class ALLOCATOR > | |
static void | defaultConstruct (typename bsl::allocator_traits< ALLOCATOR >::pointer begin, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | defaultConstruct (TARGET_TYPE *begin, size_type numElements, bslma::Allocator *allocator) |
template<class ALLOCATOR > | |
static void | destructiveMove (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | destructiveMove (TARGET_TYPE *toBegin, TARGET_TYPE *fromBegin, TARGET_TYPE *fromEnd, bslma::Allocator *allocator) |
template<class ALLOCATOR , class... ARGS> | |
static void | destructiveMoveAndEmplace (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer *fromEndPtr, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer position, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, ALLOCATOR allocator, ARGS &&... arguments) |
template<class ALLOCATOR > | |
static void | destructiveMoveAndInsert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer *fromEndPtr, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer position, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | destructiveMoveAndInsert (TARGET_TYPE *toBegin, TARGET_TYPE **fromEndPtr, TARGET_TYPE *fromBegin, TARGET_TYPE *position, TARGET_TYPE *fromEnd, size_type numElements, bslma::Allocator *allocator) |
template<class ALLOCATOR > | |
static void | destructiveMoveAndInsert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer *fromEndPtr, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer position, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, const typename bsl::allocator_traits< ALLOCATOR >::value_type &value, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | destructiveMoveAndInsert (TARGET_TYPE *toBegin, TARGET_TYPE **fromEndPtr, TARGET_TYPE *fromBegin, TARGET_TYPE *position, TARGET_TYPE *fromEnd, const TARGET_TYPE &value, size_type numElements, bslma::Allocator *allocator) |
template<class ALLOCATOR , class FWD_ITER > | |
static void | destructiveMoveAndInsert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer *fromEndPtr, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer position, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, FWD_ITER first, FWD_ITER last, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE , class FWD_ITER > | |
static void | destructiveMoveAndInsert (TARGET_TYPE *toBegin, TARGET_TYPE **fromEndPtr, TARGET_TYPE *fromBegin, TARGET_TYPE *position, TARGET_TYPE *fromEnd, FWD_ITER first, FWD_ITER last, size_type numElements, bslma::Allocator *allocator) |
template<class ALLOCATOR > | |
static void | destructiveMoveAndMoveInsert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer *fromEndPtr, typename bsl::allocator_traits< ALLOCATOR >::pointer *lastPtr, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer position, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, typename bsl::allocator_traits< ALLOCATOR >::pointer first, typename bsl::allocator_traits< ALLOCATOR >::pointer last, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | destructiveMoveAndMoveInsert (TARGET_TYPE *toBegin, TARGET_TYPE **fromEndPtr, TARGET_TYPE **lastPtr, TARGET_TYPE *fromBegin, TARGET_TYPE *position, TARGET_TYPE *fromEnd, TARGET_TYPE *first, TARGET_TYPE *last, size_type numElements, bslma::Allocator *allocator) |
template<class ALLOCATOR , class... ARGS> | |
static void | emplace (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer toEnd, ALLOCATOR allocator, ARGS &&... arguments) |
template<class TARGET_TYPE , class... ARGS> | |
static void | emplace (TARGET_TYPE *toBegin, TARGET_TYPE *toEnd, bslma::Allocator *allocator, ARGS &&... args) |
template<class ALLOCATOR > | |
static void | erase (typename bsl::allocator_traits< ALLOCATOR >::pointer first, typename bsl::allocator_traits< ALLOCATOR >::pointer middle, typename bsl::allocator_traits< ALLOCATOR >::pointer last, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | erase (TARGET_TYPE *first, TARGET_TYPE *middle, TARGET_TYPE *last, bslma::Allocator *allocator=0) |
template<class ALLOCATOR > | |
static void | insert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer toEnd, bslmf::MovableRef< typename bsl::allocator_traits< ALLOCATOR >::value_type > value, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | insert (TARGET_TYPE *toBegin, TARGET_TYPE *toEnd, bslmf::MovableRef< TARGET_TYPE > value, bslma::Allocator *allocator) |
template<class ALLOCATOR > | |
static void | insert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer toEnd, const typename bsl::allocator_traits< ALLOCATOR >::value_type &value, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | insert (TARGET_TYPE *toBegin, TARGET_TYPE *toEnd, const TARGET_TYPE &value, size_type numElements, bslma::Allocator *allocator) |
template<class ALLOCATOR , class FWD_ITER > | |
static void | insert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer toEnd, FWD_ITER fromBegin, FWD_ITER fromEnd, size_type numElements, ALLOCATOR allocator) |
template<class ALLOCATOR , class SOURCE_TYPE > | |
static void | insert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer toEnd, SOURCE_TYPE *fromBegin, SOURCE_TYPE *fromEnd, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE , class FWD_ITER > | |
static void | insert (TARGET_TYPE *toBegin, TARGET_TYPE *toEnd, FWD_ITER fromBegin, FWD_ITER fromEnd, size_type numElements, bslma::Allocator *allocator) |
template<class TARGET_TYPE , class SOURCE_TYPE > | |
static void | insert (TARGET_TYPE *toBegin, TARGET_TYPE *toEnd, SOURCE_TYPE *fromBegin, SOURCE_TYPE *fromEnd, size_type numElements, bslma::Allocator *allocator) |
template<class ALLOCATOR > | |
static void | moveInsert (typename bsl::allocator_traits< ALLOCATOR >::pointer toBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer toEnd, typename bsl::allocator_traits< ALLOCATOR >::pointer *fromEndPtr, typename bsl::allocator_traits< ALLOCATOR >::pointer fromBegin, typename bsl::allocator_traits< ALLOCATOR >::pointer fromEnd, size_type numElements, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | moveInsert (TARGET_TYPE *toBegin, TARGET_TYPE *toEnd, TARGET_TYPE **fromEndPtr, TARGET_TYPE *fromBegin, TARGET_TYPE *fromEnd, size_type numElements, bslma::Allocator *allocator) |
template<class TARGET_TYPE > | |
static void | rotate (TARGET_TYPE *first, TARGET_TYPE *middle, TARGET_TYPE *last) |
template<class ALLOCATOR > | |
static void | uninitializedFillN (typename bsl::allocator_traits< ALLOCATOR >::pointer begin, size_type numElements, const typename bsl::allocator_traits< ALLOCATOR >::value_type &value, ALLOCATOR allocator) |
template<class TARGET_TYPE > | |
static void | uninitializedFillN (TARGET_TYPE *begin, size_type numElements, const TARGET_TYPE &value, bslma::Allocator *allocator) |
This struct
provides a namespace for a suite of independent utility functions that operate on arrays of elements of parameterized type TARGET_TYPE
. Depending on the traits of TARGET_TYPE
, the default and copy constructors, destructor, assignment operators, etcetera may not be invoked, optimized away by no-op or bit-wise move or copy.
typedef std::ptrdiff_t bslalg::ArrayPrimitives::difference_type |
typedef std::size_t bslalg::ArrayPrimitives::size_type |
|
inlinestatic |
Copy into an uninitialized array of (the template parameter) TARGET_TYPE
beginning at the specified toBegin
address, the elements in the array of TARGET_TYPE
starting at the specified fromBegin
address and ending immediately before the specified fromEnd
address. If the (template parameter) ALLOCATOR
type is derived from bslma::Allocator
and TARGET_TYPE
supports bslma
allocators, then the specified allocator
is passed to each invocation of the TARGET_TYPE
copy constructor. If a TARGET_TYPE
constructor throws an exception during the operation, then the destructor is called on any newly-constructed elements, leaving the output array in an uninitialized state.
|
inlinestatic |
|
static |
Copy the elements of type allocator_traits<ALLOCATOR>::value_type
in the range beginning at the specified fromBegin
location and ending immediately before the specified fromEnd
location into the uninitialized array beginning at the specified toBegin
location, using the specified allocator
to supply memory (if required). If a constructor throws an exception during this operation, the output array is left in an uninitialized state. The behavior is undefined unless toBegin
refers to space sufficient to hold fromEnd - fromBegin
elements.
Overload resolution will handle the case where FWD_ITER
is a raw pointer, so we need handle only user-defined iterators. As bslalg
is levelized below bslstl
we cannot use iterator_traits
, but rely on the same property as iterator_traits
that this typedef must be defined for any standard-conforming iterator, unless the iterator explicitly specialized the std::iterator_traits
template. In practice, iterators always prefer to provide the member typedef than specialize the traits as it is a much simpler implementation, so this assumption is good enough.
Also note that as we know that FWD_ITER
is not a pointer, then we cannot take advantage of bitwise copying as we do not have pointers to pass to the memcpy
describing the whole range. It is not worth the effort to try to bitwise copy one element at a time.
We want to detect the special case of copying function pointers to void *
or const void *
pointers.
|
inlinestatic |
|
inlinestatic |
Construct each of the elements of an array of the specified numElements
of the parameterized TARGET_TYPE
starting at the specified begin
address by value-initialization. If the (template parameter) ALLOCATOR
type is derived from bslma::Allocator
and TARGET_TYPE
supports bslma
allocators, then the specified allocator
is passed to each TARGET_TYPE
default constructor call. The behavior is undefined unless the output array contains at least numElements
uninitialized elements after begin
. If a TARGET_TYPE
constructor throws an exception during this operation, then the destructor is called on any newly-constructed elements, leaving the output array in an uninitialized state.
|
inlinestatic |
Value-inititalize the specified numElements
objects of type allocator_traits<ALLOCATOR>::value_type
into the uninitialized array beginning at the specified begin
location, using the specified allocator
to supply memory (if required). If a constructor throws an exception during this operation, then the destructor is called on any newly constructed elements, leaving the output array in an uninitialized state. The behavior is undefined unless the begin
refers to space sufficient to hold numElements
.
|
inlinestatic |
Move the elements of the parameterized TARGET_TYPE
in the array starting at the specified fromBegin
address and ending immediately before the specified fromEnd
address into an uninitialized array of TARGET_TYPE
beginning at the specified toBegin
address. On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If the parameterized ALLOCATOR
type is derived from bslma::Allocator
and TARGET_TYPE
supports bslma
allocators, then the specified allocator
is used by the objects in their new location. If an exception is thrown by a TARGET_TYPE
constructor during the operation, then the output array is left in an uninitialized state and the input elements remain in their original state.
|
inlinestatic |
Move the elements of type allocator_traits<ALLOCATOR>::value_type
in the range beginning at the specified fromBegin
location and ending immediately before the specified fromEnd
location into the uninitialized array beginning at the specified toBegin
location, using the specified allocator
to supply memory (if required). On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. If a constructor other than the move constructor of a non-copy-constructible type throws an exception during this operation, the input array is unaffected; otherwise, if the move constructor of a non-copy-constructible type throws an exception during this operation, the input array is left in a valid but unspecified state. The behavior is undefined unless toBegin
refers to space sufficient to hold fromEnd - fromBegin
elements.
|
static |
Move the elements of type allocator_traits<ALLOCATOR>::value_type
in the specified range [fromBegin .. fromEnd)
into the uninitialized array beginning at the specified toBegin
location, using the specified allocator
to supply memory (if required), inserting at the specified position
(after translating from fromBegin
to toBegin
) a newly created object constructed by forwarding allocator
(if required) and the specified (variable number of) arguments
to the corresponding constructor of the target type, ensuring that the specified fromEndPtr
points to the first uninitialized element in [fromBegin .. fromEnd)
as the elements are moved from source to destination. On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. If an exception is thrown during the in-place construction of the new object, the input array is unaffected; otherwise, if a (copy or move) constructor throws an exception during this operation, the input elements in the range [fromBegin .. *fromEndPtr)
are left in a valid but unspecified state and the remaining portion of the input array is left in an uninitialized state. The behavior is undefined unless fromBegin <= position <= fromEnd
and toBegin
refers to space sufficient to hold fromEnd - fromBegin + 1
elements.
|
static |
Move the elements of the parameterized TARGET_TYPE
in the array starting at the specified fromBegin
address and ending immediately before the specified fromEnd
address into an uninitialized array of TARGET_TYPE
at the specified toBegin
address, inserting at the specified position
(after translating from fromBegin
to toBegin
) the specified numElements
copies of the specified value
. Keep the pointer at the specified fromEndPtr
address pointing to the first uninitialized element in '[ fromBegin, fromEnd)' as the elements are moved from source to destination. The behavior is undefined unless fromBegin <= position <= fromEnd
and the destination array contains at least (fromEnd - fromBegin) + numElements
uninitialized elements. If a copy constructor or assignment operator for TARGET_TYPE
throws an exception, then any elements created in the output array are destroyed and the elements in the range [ fromBegin, *fromEndPtr )
will have unspecified but valid values.
|
inlinestatic |
Move the elements of the parameterized TARGET_TYPE
in the array starting at the specified fromBegin
address and ending immediately before the specified fromEnd
address into an uninitialized array of TARGET_TYPE
at the specified toBegin
address, inserting at the specified position
(after translating from fromBegin
to toBegin
) the specified numElements
copies of the non-modifiable elements from the range starting at the specified first
iterator of the parameterized FWD_ITER
type and ending immediately before the specified last
iterator. Keep the pointer at the specified fromEndPtr
to point to the first uninitialized element in [fromBegin, fromEnd)
as the elements are moved from source to destination. The behavior is undefined unless fromBegin <= position <= fromEnd
, the destination array contains at least (fromEnd - fromBegin) + numElements
uninitialized elements after toBegin
, and numElements
is the distance from first
to last
. If a copy constructor or assignment operator for TARGET_TYPE
throws an exception, then any elements created in the output array are destroyed and the elements in the range [ fromBegin, *fromEndPtr )
will have unspecified but valid values.
|
inlinestatic |
Move the elements of the (template parameter) TARGET_TYPE
in the starting at the specified fromBegin
address and ending immediately before the specified fromEnd
address into the uninitialized array beginning at the specified toBegin
location using the specified allocator
to supply memory (if required), inserting at the specified position
(after translating from fromBegin
to toBegin
) numElements
objects initialized to default values, ensuring that the specified fromEndPtr
points to the first uninitialized element in [fromBegin .. fromEnd)
as the elements are moved from source to destination. On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. If a default constructor throws an exception, the input array is unaffected; otherwise, if a (copy or move) constructor throws an exception during this operation, the input elements in the range [fromBegin .. *fromEndPtr)
are left in a valid but unspecified state and the remaining portion of the input array is left in an uninitialized state. The behavior is undefined unless fromBegin <= position <= fromEnd
and toBegin
refers to space sufficient to hold fromEnd - fromBegin + numElements
elements.
|
static |
Move the elements of type allocator_traits<ALLOCATOR>::value_type
in the range beginning at the specified fromBegin
location and ending immediately before the specified fromEnd
location into the uninitialized array beginning at the specified toBegin
location using the specified allocator
to supply memory (if required), inserting at the specified position
(after translating from fromBegin
to toBegin
) the specified numElements
copies of the specified value
, ensuring that the specified fromEndPtr
points to the first uninitialized element in [fromBegin .. fromEnd)
as the elements are moved from source to destination. On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. If a (copy or move) constructor throws an exception during this operation, the input elements in the range [fromBegin .. *fromEndPtr)
are left in a valid but unspecified state and the remaining portion of the input array is left in an uninitialized state. The behavior is undefined unless fromBegin <= position <= fromEnd
and toBegin
refers to space sufficient to hold fromEnd - fromBegin + numElements
elements.
|
static |
Move the elements of type allocator_traits<ALLOCATOR>::value_type
in the range beginning at the specified fromBegin
location and ending immediately before the specified fromEnd
location into the uninitialized array beginning at the specified toBegin
location using the specified allocator
to supply memory (if required), inserting at the specified position
(after translating from fromBegin
to toBegin
) the specified numElements
copies of the non-modifiable elements from the range starting at the specified first
iterator of (template parameter) type FWD_ITER
and ending immediately before the specified last
iterator, ensuring that the specified fromEndPtr
points to the first uninitialized element in [fromBegin .. fromEnd)
as the elements are moved from source to destination. On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. If a constructor other than the copy or move constructor throws an exception during this operation, the input array is unaffected; otherwise, if a copy or move constructor throws an exception during this operation, the input elements in the range [fromBegin .. *fromEndPtr)
are left in a valid but unspecified state and the remaining portion of the input array is left in an uninitialized state. The behavior is undefined unless fromBegin <= position <= fromEnd
and toBegin
refers to space sufficient to hold fromEnd - fromBegin + numElements
elements.
|
static |
Move the elements of type allocator_traits<ALLOCATOR>::value_type
in the range beginning at the specified fromBegin
location and ending immediately before the specified fromEnd
location into the uninitialized array beginning at the specified toBegin
location using the specified allocator
to supply memory (if required), inserting at the specified position
(after translating from fromBegin
to toBegin
) the specified numElements
objects initialized to default values, ensuring that the specified fromEndPtr
points to the first uninitialized element in [fromBegin .. fromEnd)
as the elements are moved from source to destination. On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. If a default constructor throws an exception, the input array is unaffected; otherwise, if a (copy or move) constructor throws an exception during this operation, the input elements in the range [fromBegin .. *fromEndPtr)
are left in a valid but unspecified state and the remaining portion of the input array is left in an uninitialized state. The behavior is undefined unless 'fromBegin <= position <= fromEnd' and toBegin
refers to space sufficient to hold fromEnd - fromBegin + 1
elements.
|
inlinestatic |
Move the elements of (template parameter) TARGET_TYPE
in the array starting at the specified fromBegin
address and ending immediately before the specified fromEnd
address into an uninitialized array of TARGET_TYPE
at the specified toBegin
address, moving into the specified position
(after translating from fromBegin
to toBegin
) the specified numElements
of the TARGET_TYPE
from the array starting at the specified first
address and ending immediately before the specified last
address. Keep the pointer at the specified fromEndPtr
address pointing to the first uninitialized element in [fromBegin, fromEnd)
, and the pointer at the specified lastPtr
address pointing to the end of the moved range as the elements from the range [ first, last)
are moved from source to destination. The behavior is undefined unless fromBegin <= position <= fromEnd
, the destination array contains at least (fromEnd - fromBegin) + numElements
uninitialized elements after toBegin
, and numElements
is the distance from first
to last
. If a copy constructor or assignment operator for TARGET_TYPE
throws an exception, then any elements in [ *lastPtr, last )
as well as in [ toBegin, ... )
are destroyed, and the elements in the ranges [ first, *lastPtr )
and [ fromBegin, *fromEndPtr )
will have unspecified but valid values.
|
static |
TBD: improve comment Move, into an uninitialized array beginning at the specified toBegin
pointer, elements of type given by the allocator_traits
class template for (template parameter) ALLOCATOR
, from elements starting at the specified fromBegin
pointer and ending immediately before the specified fromEnd
address, moving into the specified position
(after translating from fromBegin
to toBegin
) the specified numElements
elements starting at the specified first
pointer and ending immediately before the specified last
pointer. Keep the pointer at the specified fromEndPtr
address pointing to the first uninitialized element in [ fromBegin, fromEnd)
as the elements are moved from source to destination. The behavior is undefined unless fromBegin <= position <= fromEnd
and the destination array contains at least (fromEnd - fromBegin) + numElements
uninitialized elements. If a constructor or assignment operator for the target type throws an exception, then any elements created in the output array are destroyed and the elements in the range [ fromBegin, *fromEndPtr )
will have valid but unspecified values.
|
inlinestatic |
Insert a newly created object of the (template parameter) type TARGET_TYPE
, constructed by forwarding the specified allocator
(if required) and the specified (variable number of) arguments
to the corresponding constructor of TARGET_TYPE
, into the array at the specified toBegin
address, shifting the elements from toBegin
to the specified toEnd
address up one position towards larger addresses. If an exception is thrown during the in-place construction of the new object, the elements in the range [toBegin .. toEnd)
are unaffected; otherwise, if a (copy or move) constructor or a (copy or move) assignment operator throws an exception, then any elements created after toEnd
are destroyed and the elements in the range [toBegin .. toEnd )
are left in a valid but unspecified state. The behavior is undefined unless toBegin
refers to sufficient space to hold at least toEnd - toBegin + 1
elements.
|
inlinestatic |
Insert a newly created allocator_traits<ALLOCATOR>::value_type
object, constructed by forwarding the specified allocator
(if required) and the specified (variable number of) arguments
to the corresponding constructor of allocator_traits<ALLOCATOR>::value_type
, into the array at the specified toBegin
location, shifting forward the elements from toBegin
to the specified toEnd
location by one position. If an exception is thrown during the in-place construction of the new object, the elements in the range [toBegin .. toEnd)
are unaffected; otherwise, if a (copy or move) constructor or a (copy or move) assignment operator throws an exception, then any elements created after toEnd
are destroyed and the elements in the range [toBegin .. toEnd )
are left in a valid but unspecified state. The behavior is undefined unless toBegin
refers to sufficient space to hold at least toEnd - toBegin + 1
elements.
|
inlinestatic |
Destroy the elements of the parameterized TARGET_TYPE
in the array starting at the specified first
address and ending immediately before the specified middle
address, and move the elements in the array starting at middle
and ending at the specified last
address down to the first
address. If an assignment throws an exception during this process, all of the elements in the range [ first, last )
will have unspecified but valid values, and no elements are destroyed. The behavior is undefined unless first <= middle <= last
.
|
inlinestatic |
TBD: improve comment Destroy the elements of type given by the allocator_traits
class template for (template parameter) ALLOCATOR
starting at the specified first
first
pointer and ending immediately before the specified middle
pointer, and move the elements in the array starting at middle
and ending at the specified last
pointer down to the first
pointer. If an assignment throws an exception during this process, all of the elements in the range [ first, last )
will have unspecified but valid values, and no elements are destroyed. The behavior is undefined unless first <= middle <= last
.
|
inlinestatic |
Insert the specified value
into the array of the (template parameter) type TARGET_TYPE
at the specified toBegin
address, shifting the elements from toBegin
to the specified toEnd
address by one position towards larger addresses. value
is left in a valid but unspecified state. If a (copy or move) constructor or a (copy or move) assignment operator throws an exception, then any elements created after toEnd
are destroyed and the elements in the range [toBegin .. toEnd )
are left in a valid but unspecified state. The behavior is undefined unless toBegin
refers to sufficient space to hold at least toEnd - toBegin + 1
elements.
|
inlinestatic |
Insert the specified numElements
copies of the specified value
into the array of (template parameter) TARGET_TYPE
starting at the specified toBegin
address and ending immediately before the specified toEnd
address, shifting the elements in the array by numElements
positions towards larger addresses. The behavior is undefined unless the destination array contains at least numElements
uninitialized elements after toEnd
. If a copy constructor or assignment operator for TARGET_TYPE
throws an exception, then any elements created after toEnd
are destroyed and the elements in the range [ toBegin, toEnd )
will have unspecified, but valid, values.
|
inlinestatic |
Insert, into the array at the specified toBegin
location, the specified numElements
from the range starting at the specified fromBegin
and ending immediately before the specified fromEnd
iterators of the (template parameter) FWD_ITER
type (or the (template parameter) SOURCE_TYPE *
), into the array of elements of the parameterized TARGET_TYPE
starting at the specified toBegin
address and ending immediately before the specified toEnd
address, shifting the elements in the array by numElements
positions towards larger addresses. The behavior is undefined unless the destination array contains numElements
uninitialized elements after toEnd
, numElements
is the distance between fromBegin
and fromEnd
, and the input array and the destination array do not overlap. If a copy constructor or assignment operator for TARGET_TYPE
throws an exception, then any elements created after toEnd
are destroyed and the elements in the range [ toBegin, toEnd )
will have unspecified, but valid, values.
|
inlinestatic |
|
inlinestatic |
Insert the specified value
into the array of allocator_traits<ALLOCATOR>::value_type
objects at the specified toBegin
location, shifting forward the elements from toBegin
to the specified toEnd
location by one position. value
is left in a valid but unspecified state. If a (copy or move) constructor or a (copy or move) assignment operator throws an exception, then any elements created after toEnd
are destroyed and the elements in the range [toBegin .. toEnd )
are left in a valid but unspecified state. The behavior is undefined unless toBegin
refers to sufficient space to hold at least toEnd - toBegin + 1
elements.
|
static |
Insert the specified numElements
copies of the specified value
into the array of type allocator_traits<ALLOCATOR>::value_type
starting at the specified toBegin
location, shifting forward the elements from toBegin
to the specified toEnd
location by numElements
positions. If a (copy or move) constructor or a (copy or move) assignment operator throws an exception, any elements created after toEnd
are destroyed and the elements in the range [toBegin .. toEnd)
are left in a valid but unspecified state. The behavior is undefined unless toBegin
refers to space sufficient to hold at least toEnd - toBegin + numElements
elements.
|
static |
TBD: improve comment Insert the specified numElements
from the range starting at the specified fromBegin
and ending immediately before the specified fromEnd
iterators of (template parameter) FWD_ITER
type (or template parameter SOURCE_TYPE *
), into the array of elements of type given by the allocator_traits
class template for (template parameter) ALLOCATOR
, starting at the specified toBegin
address, shifting forward the elements in the array by numElements
positions. The behavior is undefined unless the destination array contains numElements
uninitialized elements after toEnd
, numElements
is the distance between fromBegin
and fromEnd
, and the input array and the destination array do not overlap. If a copy constructor or assignment operator throws an exception, then any elements created after toEnd
are destroyed and the elements in the range [ toBegin, toEnd )
will have valid but unspecified values.
Overload resolution will handle the case where FWD_ITER
is a raw pointer, so we need handle only user-defined iterators. As bslalg
is levelized below bslstl
we cannot use iterator_traits
, but rely on the same property as iterator_traits
that this typedef must be defined for any standard-conforming iterator, unless the iterator explicitly specialized the std::iterator_traits
template. In practice, iterators always prefer to provide the member typedef than specialize the traits as it is a much simpler implementation, so this assumption is good enough.
Also note that as we know that FWD_ITER
is not a pointer, then we cannot take advantage of bitwise copying as we do not have pointers to pass to the memcpy
describing the whole range. It is not worth the effort to try to bitwise copy one element at a time.
We want to detect the special case of copying function pointers to void *
or const void *
pointers.
|
static |
|
inlinestatic |
Move the elements of the (template parameter) TARGET_TYPE
starting at the specified fromBegin
address and ending immediately before the specified fromEnd
address into the uninitialized array of TARGET_TYPE
beginning at the specified toBegin
address, using the specified allocator
to supply memory (if required). The elements in the input array are left in a valid but unspecified state. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. The behavior is undefined unless toBegin
refers to space sufficient to hold fromEnd - fromBegin
elements.
|
inlinestatic |
Move the elements of type allocator_traits<ALLOCATOR>::value_type
in the range beginning at the specified fromBegin
location and ending immediately before the specified fromEnd
location into the uninitialized array beginning at the specified toBegin
location, using the specified allocator
to supply memory (if required). The elements in the input array are left in a valid but unspecified state. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. The behavior is undefined unless toBegin
refers to space sufficient to hold fromEnd - fromBegin
elements.
|
inlinestatic |
Move the elements of the (template parameter) TARGET_TYPE
in the array starting at the specified toBegin
address and ending immediately before the specified toEnd
address by the specified numElements
positions towards larger addresses, and fill the numElements
at the toBegin
address by moving the elements from the array starting at the specified fromBegin
and ending immediately before the specified fromEnd
address. Keep the iterator at the specified fromEndPtr
address pointing to the end of the range as the elements from [ fromBegin, fromEnd )
are moved from source to destination. The behavior is undefined unless the destination array contains numElements
uninitialized elements after toEnd
, numElements
is the distance from fromBegin
to fromEnd
, and the input and destination arrays do not overlap. If a copy constructor or assignment operator for TARGET_TYPE
throws an exception, then any elements created after toEnd
are destroyed, the elements in the ranges [ toBegin, toEnd)
and [ fromBegin, *fromEndPtr )
will have unspecified, but valid, values, and the elements in [ *fromEndPtr, fromEnd )
will be destroyed.
|
inlinestatic |
TBD: improve comment Move the elements of type given by the allocator_traits
class template for (template parameter) ALLOCATOR
in the array starting at the specified toBegin
location and ending immediately before the specified toEnd
location by the specified numElements
positions towards larger addresses, and fill the numElements
at the toBegin
location by moving the elements from the array starting at the specified fromBegin
and ending immediately before the specified fromEnd
location. Keep the iterator at the specified fromEndPtr
address pointing to the end of the range as the elements from [ fromBegin, fromEnd )
are moved from source to destination. The behavior is undefined unless the destination array contains numElements
uninitialized elements after toEnd
, numElements
is the distance from fromBegin
to fromEnd
, and the input and destination arrays do not overlap. If a copy constructor or assignment operator for TARGET_TYPE
throws an exception, then any elements created after toEnd
are destroyed, the elements in the ranges [ toBegin, toEnd)
and [ fromBegin, *fromEndPtr )
will have unspecified, but valid, values, and the elements in [ *fromEndPtr, fromEnd )
will be destroyed.
|
inlinestatic |
Move the elements of the parameterized TARGET_TYPE
in the array starting at the specified first
address and ending immediately before the specified middle
address to the array of the same length ending at the specified last
address (and thus starting at the last - (middle - first)
address), and move the elements previously in the array starting at middle
and ending at last
down to the first
address. If the assignment operator throws an exception during this process, all of the elements in [ first, last )
will have unspecified, but valid, values. The behavior is undefined unless first <= middle <= last
.
|
inlinestatic |
Construct copies of the specified value
of the parameterized type TARGET_TYPE
into the uninitialized array containing the specified numElements
starting at the specified begin
address. If the (template parameter) ALLOCATOR
type is derived from bslma::Allocator
and TARGET_TYPE
supports bslma
allocators, then the specified allocator
is passed to each invocation of the TARGET_TYPE
copy constructor. The behavior is undefined unless the output array contains at least numElements
uninitialized elements after begin
. If a TARGET_TYPE
constructor throws an exception during the operation, then the destructor is called on any newly-constructed elements, leaving the output array in an uninitialized state. Note that the argument order was chosen to maintain compatibility with the existing bslalg
.
|
inlinestatic |
TBD: improve comment Construct copies of the specified value
of type given by the allocator_traits
class template for (template parameter) ALLOCATOR
into the uninitialized array containing the specified numElements
starting at the specified begin
location. The behavior is undefined unless the output array contains at least numElements
uninitialized elements after begin
. If a constructor throws an exception during the operation, then the destructor is called on any newly-constructed elements, leaving the output array in an uninitialized state.