BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsltf::AllocArgumentType< N > Class Template Reference

#include <bsltf_allocargumenttype.h>

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 ()
 Destroy this object.
 
AllocArgumentTypeoperator= (const AllocArgumentType &rhs)
 Assign to this object the value of the specified rhs object.
 
AllocArgumentTypeoperator= (BloombergLP::bslmf::MovableRef< AllocArgumentType > rhs)
 
bslma::Allocatorallocator () const
 Return the allocator used by this object to supply memory.
 
 operator int () const
 Return the value of this test argument object.
 
MoveState::Enum movedInto () const
 Return the move state of this object as target of a move operation.
 
MoveState::Enum movedFrom () const
 Return the move state of this object as source of a move operation.
 

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

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. 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

Member Function Documentation

◆ allocator()

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

◆ movedFrom()

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

◆ movedInto()

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

◆ operator int()

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

◆ 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 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

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