BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstp::Util Class Reference

#include <bslstp_util.h>

Static Public Member Functions

template<class ALLOCATOR >
static ALLOCATOR copyContainerAllocator (const ALLOCATOR &rhsAlloc)
 
template<class CONTAINER , class QUICKSWAP_FUNC >
static void swapContainers (CONTAINER &c1, CONTAINER &c2, const QUICKSWAP_FUNC &quickswap)
 

Detailed Description

Namespace for utility functions used to implement STL functionality.

See bslstp_util

Member Function Documentation

◆ copyContainerAllocator()

template<class ALLOCATOR >
ALLOCATOR bslstp::Util::copyContainerAllocator ( const ALLOCATOR &  rhsAlloc)
inlinestatic

Return the appropriate allocator for use when copy-constructing a container. rhsAlloc is intended to be the allocator from the container being copied. If the ALLOCATOR type uses bslma allocator semantics, then ignore rhsAlloc and return the default allocator. Otherwise, return rhsAlloc unchanged.

◆ swapContainers()

template<class CONTAINER , class QUICKSWAP_FUNC >
void bslstp::Util::swapContainers ( CONTAINER &  c1,
CONTAINER &  c2,
const QUICKSWAP_FUNC &  quickswap 
)
static

Swap the contents of containers c1 and c2, correctly handling the case where the two containers have different allocator values. The quickswap argument is a binary function object that is called to quickly swap two CONTAINER objects with matching allocators. (The quickswap object does not need to check that the allocator matched – it is guaranteed by the caller.) Strong exception guarantee: if the allocator or copy constructor of either container throws an exception, then the values of c1 and c2 are left unchanged. The quickswap function must not throw an exception.


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