ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::boxing::TBoxes< TAllocator > Class Template Reference

Description:

template<typename TAllocator>
class alib::boxing::TBoxes< TAllocator >

A vector of objects of type Box. Specializes class std::vector<Box> (publicly) with a constructor and methods to add a variable number 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.
Template Parameters
TAllocatorThe allocator to use with the std::vector, as prototyped with Allocator.

Definition at line 27 of file boxes.inl.

Inheritance diagram for alib::boxing::TBoxes< TAllocator >:
[legend]
Collaboration diagram for alib::boxing::TBoxes< TAllocator >:
[legend]

Public Type Index:

using AllocatorType = TAllocator
 The allocator type that TAllocator specifies.
 

Public Method Index:

 TBoxes ()
 Defaulted default constructor, usable only with heap allocation.
 
 TBoxes (TAllocator &pAllocator)
 
 TBoxes (TBoxes &)=delete
 Deleted copy constructor.
 
TBoxesAdd ()
 
TBoxesAdd (const Box &box)
 
template<size_t TExtend>
TBoxesAdd (const Box(&boxArray)[TExtend])
 
template<typename TAllocatorArgs>
TBoxesAdd (const TBoxes< TAllocatorArgs > &boxes)
 
template<typename... TBoxables>
TBoxesAdd (TBoxables &&... args)
 
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
 
void CloneAll ()
 
template<typename TBoxable>
TBoxesoperator+= (TBoxable &&src)
 
template<typename TBoxable>
TBoxesoperator<< (TBoxable &&src)
 
TBoxesoperator= (TBoxes &)=delete
 
void Reserve (integer newCapacity)
 
integer Size () const
 

Protected Type Index:

using vectorBase = std::vector<Box, lang::StdContainerAllocator<Box, TAllocator>>
 The allocator type that TAllocator specifies.
 

Type Definition Details:

◆ AllocatorType

template<typename TAllocator>
using alib::boxing::TBoxes< TAllocator >::AllocatorType = TAllocator

The allocator type that TAllocator specifies.

Definition at line 35 of file boxes.inl.

◆ vectorBase

template<typename TAllocator>
using alib::boxing::TBoxes< TAllocator >::vectorBase = std::vector<Box, lang::StdContainerAllocator<Box, TAllocator>>
protected

The allocator type that TAllocator specifies.

Definition at line 31 of file boxes.inl.

Constructor(s) / Destructor Details:

◆ TBoxes() [1/2]

template<typename TAllocator>
alib::boxing::TBoxes< TAllocator >::TBoxes ( )
inline

Defaulted default constructor, usable only with heap allocation.

Definition at line 38 of file boxes.inl.

◆ TBoxes() [2/2]

template<typename TAllocator>
alib::boxing::TBoxes< TAllocator >::TBoxes ( TAllocator & pAllocator)
inline

Constructor.

Parameters
pAllocatorThe allocator to use.

Definition at line 42 of file boxes.inl.

Method Details:

◆ Add() [1/5]

template<typename TAllocator>
TBoxes & alib::boxing::TBoxes< TAllocator >::Add ( )
inline

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

Returns
A reference to this object.

Definition at line 61 of file boxes.inl.

◆ Add() [2/5]

template<typename TAllocator>
TBoxes & alib::boxing::TBoxes< TAllocator >::Add ( const Box & box)
inline

Adds one boxt.

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

Definition at line 89 of file boxes.inl.

◆ Add() [3/5]

template<typename TAllocator>
template<size_t TExtend>
TBoxes & alib::boxing::TBoxes< TAllocator >::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 104 of file boxes.inl.

◆ Add() [4/5]

template<typename TAllocator>
template<typename TAllocatorArgs>
TBoxes & alib::boxing::TBoxes< TAllocator >::Add ( const TBoxes< TAllocatorArgs > & boxes)
inline

Adds all elements of the given other TBoxes object.

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

Definition at line 117 of file boxes.inl.

◆ Add() [5/5]

template<typename TAllocator>
template<typename... TBoxables>
TBoxes & alib::boxing::TBoxes< TAllocator >::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 75 of file boxes.inl.

◆ AddArray()

template<typename TAllocator>
template ALIB_DLL void alib::boxing::TBoxes< TAllocator >::AddArray ( const Box * boxArray,
integer length )

Adds an array of boxes. Array elements of types TBoxes 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]

template<typename TAllocator>
template<typename TFDecl, typename... TArgs>
void alib::boxing::TBoxes< TAllocator >::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 208 of file boxes.inl.

◆ CallAll() [2/2]

template<typename TAllocator>
template<typename TFDecl, typename... TArgs>
void alib::boxing::TBoxes< TAllocator >::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 189 of file boxes.inl.

◆ CloneAll()

template<typename TAllocator>
void alib::boxing::TBoxes< TAllocator >::CloneAll ( )
inline

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. Cloning is performed 'into' the allocator used by the Boxes instance.

Availability
This method is available only if the module ALib Monomem is included in the ALib Build.

Definition at line 224 of file boxes.inl.

◆ operator+=()

template<typename TAllocator>
template<typename TBoxable>
TBoxes & alib::boxing::TBoxes< TAllocator >::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 142 of file boxes.inl.

◆ operator<<()

template<typename TAllocator>
template<typename TBoxable>
TBoxes & alib::boxing::TBoxes< TAllocator >::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 154 of file boxes.inl.

◆ operator=()

template<typename TAllocator>
TBoxes & alib::boxing::TBoxes< TAllocator >::operator= ( TBoxes< TAllocator > & )
delete

Deleted copy assignment operator.

Returns
Nothing (deleted).

◆ Reserve()

template<typename TAllocator>
void alib::boxing::TBoxes< TAllocator >::Reserve ( integer newCapacity)
inline

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

Parameters
newCapacityThe new, higher capacity of the vector.

Definition at line 173 of file boxes.inl.

◆ Size()

template<typename TAllocator>
integer alib::boxing::TBoxes< TAllocator >::Size ( ) const
inline

Returns the quantity of elements stored in ths container.

Returns
The element count.

Definition at line 163 of file boxes.inl.


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