Crystal Space: csArrayCapacityLinear< Threshold > Class Template Reference (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csArrayCapacityLinear< Threshold > Class Template Reference
[Containers]

csArray capacity handler. More...

`#include <csutil/array.h>`

List of all members.

## Public Member Functions
| csArrayCapacityLinear (const size_t x)
| Construct capacity handler with a given size_t parameter for the Threshold object.
size_t | GetCapacity (size_t count) const
| Compute the capacity for a given number of items.
bool | IsCapacityExcessive (size_t capacity, size_t count) const
| Returns "true" if the given capacity is too large for the given count, that is, if GetCapacity() would return a value for count smaller than capacity.
| csArrayCapacityLinear (const Threshold &threshold)
| csArrayCapacityLinear ()
| Construct capacity handler.

## Detailed Description

### template<typename Threshold = csArrayThresholdVariable>
class csArrayCapacityLinear< Threshold >

csArray capacity handler.

Different capacity handlers allow to realize different csArray internal growth behaviours, if needed. This default "linear" handler will result in array capacity growth to multiples of Threshold and works well enough in most cases.

Definition at line 278 of file array.h.

## Constructor & Destructor Documentation

template<typename Threshold = csArrayThresholdVariable>

csArrayCapacityLinear< Threshold >::csArrayCapacityLinear | ( |  | ) | `[inline]`

Construct capacity handler.

Definition at line 283 of file array.h.

template<typename Threshold = csArrayThresholdVariable>

csArrayCapacityLinear< Threshold >::csArrayCapacityLinear | ( | const size_t | x | ) | `[inline]`

Construct capacity handler with a given size_t parameter for the Threshold object.

The exact meaning of x depends on the Threshold implementation.

Remarks:
  Mostly for compatibility with existing code.

Definition at line 293 of file array.h.

## Member Function Documentation

template<typename Threshold = csArrayThresholdVariable>

size_t csArrayCapacityLinear< Threshold >::GetCapacity | ( | size_t | count | ) | const`[inline]`

Compute the capacity for a given number of items.

The capacity will commonly be larger than the actual count to reduce the number of memory allocations when pushing items onto an array.

Definition at line 311 of file array.h.

template<typename Threshold = csArrayThresholdVariable>

bool csArrayCapacityLinear< Threshold >::IsCapacityExcessive | ( | size_t | capacity,
|  | size_t | count |
| ) |  |  | const`[inline]`

Returns "true" if the given capacity is too large for the given count, that is, if GetCapacity() would return a value for count smaller than capacity.

Definition at line 301 of file array.h.

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

- csutil/array.h