BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bsltf::AllocArgumentType< N > Class Template Reference

#include <bsltf_allocargumenttype.h>

Detailed Description

template<int N>
class bsltf::AllocArgumentType< N >

This class template declares a separate type for each template parameter value N, bsltf::AllocArgumentType<N>, that wraps an integer value and provides implicit conversion to and from int. The wrapped integer will be dynamically allocated using the supplied allocator, or the default allocator if none is supplied. Its main purpose is that having separate types for testing enables distinguishing them when calling through a function template interface, thereby avoiding ambiguities or accidental switching of arguments in the implementation of in-place constructors. It further tests that allocators are propagated correctly, or not, as required.

See bsltf_allocargumenttype

Public Member Functions

 AllocArgumentType (bslma::Allocator *basicAllocator=0)
 
 AllocArgumentType (int value, bslma::Allocator *basicAllocator=0)
 
 AllocArgumentType (const AllocArgumentType &original, bslma::Allocator *basicAllocator=0)
 
 AllocArgumentType (bslmf::MovableRef< AllocArgumentType > original)
 
 AllocArgumentType (bslmf::MovableRef< AllocArgumentType > original, bslma::Allocator *basicAllocator)
 
 ~AllocArgumentType ()
 
AllocArgumentTypeoperator= (const AllocArgumentType &rhs)
 
AllocArgumentTypeoperator= (BloombergLP::bslmf::MovableRef< AllocArgumentType > rhs)
 
bslma::Allocatorallocator () const
 
 operator int () const
 
MoveState::Enum movedInto () const
 
MoveState::Enum movedFrom () const
 

Constructor & Destructor Documentation

◆ AllocArgumentType() [1/5]

template<int N>
bsltf::AllocArgumentType< N >::AllocArgumentType ( bslma::Allocator basicAllocator = 0)
inlineexplicit

Create an AllocArgumentType object having the (default) attribute value -1. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. Note, that default constructor does not allocate memory.

◆ AllocArgumentType() [2/5]

template<int N>
bsltf::AllocArgumentType< N >::AllocArgumentType ( int  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

Create an AllocArgumentType object having the specified value. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

Precondition
The behavior is undefined unless value >= 0.

◆ AllocArgumentType() [3/5]

template<int N>
bsltf::AllocArgumentType< N >::AllocArgumentType ( const AllocArgumentType< N > &  original,
bslma::Allocator basicAllocator = 0 
)
inline

Create an AllocArgumentType object having the same value as the specified original. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. Note, that no memory is allocated if original refers to a default-constructed object.

◆ AllocArgumentType() [4/5]

template<int N>
bsltf::AllocArgumentType< N >::AllocArgumentType ( bslmf::MovableRef< AllocArgumentType< N > >  original)
inline

Create an AllocArgumentType object having the same value as the specified original. Note, that no memory is allocated if original refers to a default-constructed object.

◆ AllocArgumentType() [5/5]

template<int N>
bsltf::AllocArgumentType< N >::AllocArgumentType ( bslmf::MovableRef< AllocArgumentType< N > >  original,
bslma::Allocator basicAllocator 
)
inline

Create an AllocArgumentType object having the same value as the specified original using the specified basicAllocator to supply memory. Note, that no memory is allocated if original refers to a default-constructed object.

◆ ~AllocArgumentType()

template<int N>
bsltf::AllocArgumentType< N >::~AllocArgumentType ( )
inline

Destroy this object.

Member Function Documentation

◆ allocator()

template<int N>
bslma::Allocator * bsltf::AllocArgumentType< N >::allocator ( ) const
inline

Return the allocator used by this object to supply memory.

◆ movedFrom()

template<int N>
MoveState::Enum bsltf::AllocArgumentType< N >::movedFrom ( ) const
inline

Return the move state of this object as source of a move operation.

◆ movedInto()

template<int N>
MoveState::Enum bsltf::AllocArgumentType< N >::movedInto ( ) const
inline

Return the move state of this object as target of a move operation.

◆ operator int()

template<int N>
bsltf::AllocArgumentType< N >::operator int ( ) const
inline

Return the value of this test argument object.

◆ operator=() [1/2]

template<int N>
AllocArgumentType< N > & bsltf::AllocArgumentType< N >::operator= ( BloombergLP::bslmf::MovableRef< AllocArgumentType< N > >  rhs)
inline

Assign to this object the value of the specified rhs object.

Note
Note that rhs is left in a valid but unspecified state.

◆ operator=() [2/2]

template<int N>
AllocArgumentType< N > & bsltf::AllocArgumentType< N >::operator= ( const AllocArgumentType< N > &  rhs)
inline

Assign to this object the value of the specified rhs object.


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