ITK  5.3.0
Insight Toolkit
Public Member Functions | List of all members
itk::VariableLengthVector< TValue >::DontShrinkToFit Struct Reference

#include <itkVariableLengthVector.h>

+ Inheritance diagram for itk::VariableLengthVector< TValue >::DontShrinkToFit:
+ Collaboration diagram for itk::VariableLengthVector< TValue >::DontShrinkToFit:

Public Member Functions

bool operator() (unsigned int newSize, unsigned int oldSize) const
 

Detailed Description

template<typename TValue>
struct itk::VariableLengthVector< TValue >::DontShrinkToFit

VariableLengthVector Allocation Policy: reallocate memory only when size increases. This policy, when used from VariableLengthVector::SetSize(), will reallocate the internal buffer only if the new size requested for the VariableLengthVector increases.

Returns
whether newSize is bigger than oldSize
Warning
Unlike classes like std::vector<>, VariableLengthVector has no capacity concept: the size of the VariableLengthVector is its capacity. However, this will help a class without capacity to emulate one. The consequence is that reallocations will occur with scenarios such as the following:
v.SetSize(42);
v.SetSize(12); // no reallocation
v.SetSize(42); // pointless reallocation (given this policy)
See also
itk::VariableLengthVector::SetSize
AlwaysReallocate
NeverReallocate
ShrinkToFit

Definition at line 223 of file itkVariableLengthVector.h.

Member Function Documentation

◆ operator()()

template<typename TValue>
bool itk::VariableLengthVector< TValue >::DontShrinkToFit::operator() ( unsigned int  newSize,
unsigned int  oldSize 
) const
inline

Definition at line 226 of file itkVariableLengthVector.h.


The documentation for this struct was generated from the following file:
itk::VariableLengthVector::VariableLengthVector
VariableLengthVector()