ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Methods | List of all members
Boxes Class Reference
Inheritance diagram for Boxes:
[legend]
Collaboration diagram for Boxes:
[legend]

Class Description


A vector of objects of type Box. Specializes class std::vector<Box> (publicly) with a constructor and methods to add a variable amount of arbitrary values with one invocation.

If another Boxes object or an array of boxes, or boxed versions of such, are added, this container is "flattened", so that instead of the container, the boxes are added. Such flatting is performed recursively.

See also
Chapter 11. Variadic Function Arguments and Class Boxes of the Programmer's Manual of module ALib Boxing.

Definition at line 132 of file boxes.inl.

Public Methods

 Boxes ()=default
 
 Boxes (Boxes &)=delete
 
 Boxes (monomem::MonoAllocator *monoAllocator)
 
BoxesAdd ()
 
BoxesAdd (const Box &box)
 
template<size_t TExtend>
BoxesAdd (const Box(&boxArray)[TExtend])
 
BoxesAdd (const Boxes &boxes)
 
template<typename... TBoxables>
BoxesAdd (TBoxables &&... args)
 
ALIB_API void AddArray (const Box *boxArray, integer length)
 
template<typename TFDecl , typename... TArgs>
void CallAll (TArgs &&... args)
 
template<typename TFDecl , typename... TArgs>
void CallAll (TArgs &&... args) const
 
ALIB_API void CloneAll (monomem::MonoAllocator &memory)
 
template<typename TBoxable >
Boxesoperator+= (TBoxable &&src)
 
template<typename TBoxable >
Boxesoperator<< (TBoxable &&src)
 
Boxesoperator= (Boxes &)=delete
 
void Reserve (integer newCapacity)
 
integer Size () const
 

Constructor & Destructor Documentation

◆ Boxes() [1/3]

Boxes ( )
default

Defaulted default constructor.

◆ Boxes() [2/3]

Boxes ( Boxes )
delete

Deleted copy constructor.

◆ Boxes() [3/3]

Boxes ( monomem::MonoAllocator monoAllocator)
inline

Constructor accepting a monotonic allocator.
Note: This constructor is available only if module ALib Memory is included in the ALib Distribution.

Parameters
monoAllocatorThe allocator to use with the underlying std::vector.

Definition at line 164 of file boxes.inl.

Member Function Documentation

◆ Add() [1/5]

Boxes& Add ( )
inline

Empty method. Needed to allow adding empty variadic template parameter packs.

Returns
A reference to this object.

Definition at line 173 of file boxes.inl.

◆ Add() [2/5]

Boxes& Add ( const Box box)
inline

Adds one boxt.

Parameters
boxThe box to append.
Returns
A reference to this object.

Definition at line 201 of file boxes.inl.

Here is the call graph for this function:

◆ Add() [3/5]

Boxes& Add ( const Box(&)  boxArray[TExtend])
inline

Adds an array of boxes.

Template Parameters
TExtendThe size of the given array of boxes.
Parameters
boxArrayThe array of boxes.
Returns
A reference to this object.

Definition at line 216 of file boxes.inl.

Here is the call graph for this function:

◆ Add() [4/5]

Boxes& Add ( const Boxes boxes)
inline

Adds all elements of the given other Boxes object.

Parameters
boxesAnother container of boxes to add.
Returns
A reference to this object.

Definition at line 228 of file boxes.inl.

Here is the call graph for this function:

◆ Add() [5/5]

Boxes& Add ( TBoxables &&...  args)
inline

Adds one box for each given variadic argument.

Template Parameters
TBoxablesThe types of the variadic arguments.
Parameters
argsThe variadic arguments. Each argument is converted into one box to be appended.
Returns
A reference to this object.

Definition at line 187 of file boxes.inl.

Here is the call graph for this function:

◆ AddArray()

ALIB_API void AddArray ( const Box boxArray,
integer  length 
)

Adds an array of boxes. Array elements of types Boxes itself and boxed arrays of class Box are recursively "flattened".

This method is internally used by all overloads of Add.

Parameters
boxArrayPointer to the start of the array of boxes.
lengthThe number of boxes contained in boxArray.

◆ CallAll() [1/2]

void CallAll ( TArgs &&...  args)
inline

Non-constant version of method CallAll, which likewise chooses the non-constant version of Box::Call and hence this method is usable with functions that only accept mutable (aka not constant) boxes.
Technically, the only difference between this method and CallAll is that the latter is declared const.

Template Parameters
TFDeclThe function type to call. Needs to be specified with invocations of this method.
TArgsTypes of the variadic arguments args .
Parameters
argsVariadic arguments forwarded to the functions.

Definition at line 319 of file boxes.inl.

◆ CallAll() [2/2]

void CallAll ( TArgs &&...  args) const
inline

Invokes Box::Call with each box in this list. The result of the invocations of the box-functions is ignored.

Template Parameters
TFDeclThe function type to call. Needs to be specified with invocations of this method.
TArgsTypes of the variadic arguments args. Do not need to be specified.
Parameters
argsVariadic arguments forwarded to the functions.

Definition at line 300 of file boxes.inl.

◆ CloneAll()

void CloneAll ( monomem::MonoAllocator memory)

Same as CallAll<FClone>, but uses method Box::Clone, which internally invokes FClone.

Using this version leads to shorter code, because method Box::Clone is not inlined.

Availability

This method is available only if module ALib Memory is included in the ALib Distribution.

Parameters
memoryA monotonic allocator used for storing cloned data.

Definition at line 216 of file boxing.cpp.

◆ operator+=()

Boxes& operator+= ( TBoxable &&  src)
inline

Inline operator that simply aliases method Add.

Parameters
srcThe value to be boxed and added.
Returns
Returns a mutable reference to this.

Definition at line 253 of file boxes.inl.

Here is the call graph for this function:

◆ operator<<()

Boxes& operator<< ( TBoxable &&  src)
inline

Inline operator that simply aliases method Add.

Parameters
srcThe value to be boxed and added.
Returns
Returns a mutable reference to this.

Definition at line 265 of file boxes.inl.

Here is the call graph for this function:

◆ operator=()

Boxes& operator= ( Boxes )
delete

Deleted copy assignment operator.

Returns
Nothing (deleted).

◆ Reserve()

void Reserve ( integer  newCapacity)
inline

Invokes the corresponding parent's method std::vector::reserve.

Parameters
newCapacityThe new, higher capacity of the vector.

Definition at line 284 of file boxes.inl.

◆ Size()

integer Size ( ) const
inline

Returns the quantity of elements stored in ths container.

Returns
The element count.

Definition at line 274 of file boxes.inl.


The documentation for this class was generated from the following files: