8#ifndef HPP_ALIB_BOXING_BOXES
9#define HPP_ALIB_BOXING_BOXES 1
11#if !defined(HPP_ALIB_BOXING_BOXING)
12# error "ALib sources with ending '.inl' must not be included from outside."
16#if !defined (_GLIBCXX_VECTOR) && !defined(_VECTOR_)
23namespace alib {
namespace boxing {
namespace detail {
52 using size_type = size_t ;
53 using difference_type= ptrdiff_t ;
54 using value_type = T ;
55 using is_always_equal= std::false_type;
58 #if ALIB_CPP_STANDARD == 17
59 size_t max_size()
const noexcept {
return static_cast<size_t>(-1) / 2; }
66 template<
typename U>
BoxesAllocator( U& origin ) : allocator(origin.allocator) {}
68 : allocator(pAllocator) {}
72 {
return allocator == rhs.allocator; }
76 {
return (allocator != rhs.allocator); }
79 T* allocate(
size_t n,
const void* =
nullptr )
81 if( allocator ==
nullptr )
82 return reinterpret_cast<T*
>( std::malloc(
sizeof(T) * n ) );
85 sizeof(T[1]) * n,
alignof(T[]) ) );
88 void deallocate( T* p , std::size_t )
90 if( allocator ==
nullptr )
102namespace alib {
namespace boxing {
118 :
public std::vector<Box, detail::BoxesAllocator<Box>>
120 :
public std::vector<Box>
170 template <
typename... TBoxables>
173 Box boxes[
sizeof...(args)]= { std::forward<TBoxables>( args )... };
199 template<
size_t TExtend>
236 template <
typename TBoxable>
248 template <
typename TBoxable>
260 return static_cast<integer>( size() );
270 reserve(
static_cast<size_t>( newCapacity ) );
283 template <
typename TFDecl,
typename... TArgs>
286 for(
auto& box : *this )
287 box.Call<TFDecl>( std::forward<TArgs>(args)... );
302 template <
typename TFDecl,
typename... TArgs>
305 for(
auto& box : *this )
306 box.Call<TFDecl>( std::forward<TArgs>(args)... );
void CallAll(TArgs &&... args)
Boxes & Add(const Boxes &boxes)
Boxes & Add(const Box(&boxArray)[TExtend])
void Reserve(integer newCapacity)
Boxes & Add(const Box &box)
void CallAll(TArgs &&... args) const
Boxes & Add(TBoxables &&... args)
Boxes & operator<<(TBoxable &&src)
ALIB_API void CloneAll(monomem::MonoAllocator &memory)
ALIB_API void AddArray(const Box *boxArray, integer length)
Boxes(monomem::MonoAllocator *monoAllocator)
Boxes & operator+=(TBoxable &&src)
Boxes & operator=(Boxes &)=delete
ALIB_API char * monoAlloc(monomem::MonoAllocator &allocator, size_t size, size_t alignment)
boxing::Box Box
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.