[#BloombergLP-bslalg]
= xref:BloombergLP.adoc[BloombergLP]::bslalg
:relfileprefix: ../
:mrdocs:

Namespace for low&hyphen;level algorithms and type traits used by BSL containers&period;

== Types

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslalg/ArrayDestructionPrimitives.adoc[`ArrayDestructionPrimitives`] 
| This `struct` provides a namespace for a suite of utility functions that destroy arrays of elements of the parameterized type `TARGET&lowbar;TYPE`&period; Depending on the traits of `TARGET&lowbar;TYPE`, the destructor may be invoked, or not (optimized away by no&hyphen;op)&period;
| xref:BloombergLP/bslalg/ArrayPrimitives.adoc[`ArrayPrimitives`] 
| This `struct` provides a namespace for a suite of independent utility functions that operate on arrays of elements of parameterized type `TARGET&lowbar;TYPE`&period; Depending on the traits of `TARGET&lowbar;TYPE`, the default and copy constructors, destructor, assignment operators, etcetera may not be invoked, optimized away by no&hyphen;op or bit&hyphen;wise move or copy&period;
| xref:BloombergLP/bslalg/ArrayPrimitives_CanBitwiseCopy.adoc[`ArrayPrimitives&lowbar;CanBitwiseCopy`] 
| Metafunction that is `true` when `FROM&lowbar;TYPE` and `TO&lowbar;TYPE` are the same type (ignoring top&hyphen;level `const`) and that type is bit&hyphen;wise copyable&period;
| xref:BloombergLP/bslalg/AutoArrayDestructor.adoc[`AutoArrayDestructor`] 
| This `class` provides a specialized proctor object that, upon destruction and unless the `release` method has been called, destroys the elements in a segment of an array of parameterized type `OBJECT&lowbar;TYPE`&period; The elements destroyed are delimited by the &quot;guarded&quot; range `&lsqb; begin(), end() )&rsqb;`&period;
| xref:BloombergLP/bslalg/AutoArrayMoveDestructor.adoc[`AutoArrayMoveDestructor`] 
| This `class` provides a specialized proctor object that, upon destruction and unless the `release` method has been called, bit&hyphen;wise moves the elements in a segment of an array of parameterized `OBJECT&lowbar;TYPE` back to some destination, and destroys some other elements in an adjacent segment of the same array&period; The elements destroyed are delimited by the range `&lsqb; begin(), middle() )&rsqb;` and those moved to `destination()` and in the range `&lsqb; middle(), end() )&rsqb;`&period; Note that, once constructed, `begin()` and `end()` remain fixed&period; As the guard advances, `middle()` and `destination()` move, reflecting the successful transfer of data between the moving range and the destination&period;
| xref:BloombergLP/bslalg/AutoScalarDestructor.adoc[`AutoScalarDestructor`] 
| This `class` provides a specialized proctor object that, upon destruction and unless the `release` method is called, destroys the guarded object of the parameterized `OBJECT&lowbar;TYPE`&period;
| xref:BloombergLP/bslalg/BidirectionalLink.adoc[`BidirectionalLink`] 
| This POD&hyphen;like `class` describes a node suitable for use in a doubly&hyphen; linked (bidirectional) list, holding the addresses of the preceding and succeeding nodes, either or both of which may be 0&period; This class is &quot;POD&hyphen;like&quot; to facilitate efficient allocation and use in the context of a container implementations&period; In order to meet the essential requirements of a POD type, this `class` does not declare a constructor or destructor&period; However its data members are private&period; It satisfies the requirements of a _trivial_ type and a _standard_ _layout_ type defined by the C&plus;&plus;11 standard&period; Note that this type does not contain any &quot;payload&quot; member data&colon; Clients creating a doubly&hyphen;linked list of data must define an appropriate node type that incorporates `BidirectionalLink` (generally via inheritance), and that holds the &quot;value&quot; of any data stored in that node&period;
| xref:BloombergLP/bslalg/BidirectionalLinkListUtil.adoc[`BidirectionalLinkListUtil`] 
| This `struct` provides a namespace for utility functions that manipulate linked lists based on `bslalg&colon;&colon;BidirectionalLink` nodes, including insertion, removal, and _splicing_&period;
| xref:BloombergLP/bslalg/BidirectionalNode.adoc[`BidirectionalNode`] 
| This POD&hyphen;like `class` describes a node suitable for use in a doubly&hyphen;linked list of values of the template parameter type `VALUE`&period; This class is a &quot;POD&hyphen;like&quot; to facilitate efficient allocation and use in the context of a container implementation&period; In order to meet the essential requirements of a POD type, this `class` does not define a constructor or destructor&period; The manipulator, `value`, returns a modifiable reference to `d&lowbar;value` so that it may be constructed in&hyphen;place by the appropriate `bsl&colon;&colon;allocator&lowbar;traits` object&period;
| xref:BloombergLP/bslalg/ConstructorProxy.adoc[`ConstructorProxy`] 
| This class acts as a proxy for constructing and destroying an object of parameterized `OBJECT&lowbar;TYPE`, where `OBJECT&lowbar;TYPE` may or may not use a `bslma` allocator for supplying memory&period; The constructors for this proxy class take a `bslma&colon;&colon;Allocator &ast;`&period; If `OBJECT&lowbar;TYPE` has the `bslma&colon;&colon;UsesBslmaAllocator` trait declared, then the supplied allocator will be used to construct the proxied object&period; Otherwise, the allocator is ignored&period;
| xref:BloombergLP/bslalg/ConstructorProxy_AllocatorType-08.adoc[`ConstructorProxy&lowbar;AllocatorType`] 
| Metafunction to determine the allocator type for a specified template parameter `TYPE` using the specified template parater `AAMODEL` for constructors&period; This primary template yields a nested `type` of `bsl&colon;&colon;polymorphic&lowbar;allocator`, which is the most permisive type to use as a constructor parameter, and an `ArgType` allocator constructor argument that is a wrapper around `polymorphic&lowbar;allocator` that tolerates being constructed with a null pointer&period; However, if `AAMODEL` is `AAModelNone` or `AAModelStl`, the allocator constructor argument is ignored and not passed to the proxied object&period;
| xref:BloombergLP/bslalg/ConstructorProxy_PolymorphicAllocator.adoc[`ConstructorProxy&lowbar;PolymorphicAllocator`] 
| Wrapper around `bsl&colon;&colon;polymorphic&lowbar;allocator` that can tolerate being constructed with a null pointer&period;
| xref:BloombergLP/bslalg/ContainerBase.adoc[`ContainerBase`] 
| Allocator proxy class for STL&hyphen;style containers&period; Provides access to the allocator&period; Implements the entire STL allocator interface, redirecting allocation and deallocation calls to the proxied allocator&period; One of two possible base classes is chosen depending on whether `ALLOCATOR` is an empty class&period;
| xref:BloombergLP/bslalg/ContainerBase_EmptyBase.adoc[`ContainerBase&lowbar;EmptyBase`] 
| One of two possible base classes for `ContainerBase`&period; This class is for stateless allocators (i&period;e&period;, that have size 0), including `std&colon;&colon;allocator` (but not `bsl&colon;&colon;allocator`)&period; Provides access to the allocator&period;
| xref:BloombergLP/bslalg/ContainerBase_NonEmptyBase.adoc[`ContainerBase&lowbar;NonEmptyBase`] 
| One of two possible base classes for `ContainerBase`&period; This class should be used only for allocators with size &gt; 0 (Inheritance from this type can cause ambiguous conversions and should be avoided or insulated&period;)
| xref:BloombergLP/bslalg/DequeImpUtil.adoc[`DequeImpUtil`] 
| This `struct`, parameterized by the `VALUE&lowbar;TYPE` and a `BLOCK&lowbar;LENGTH`, provides the various parameters of the deque implementation&period;
| xref:BloombergLP/bslalg/DequeIterator-0d.adoc[`DequeIterator`] 
| Implementation of a deque iterator, parameterized by the `VALUE&lowbar;TYPE`, for a deque with the parameterized `BLOCK&lowbar;LENGTH`, and suitable for use by the `bslstl&colon;&colon;RandomAccessIterator` adapter&period; Note that `BLOCK&lowbar;LENGTH` is the number of items of `VALUE&lowbar;TYPE` within a block, not the size of a block in bytes&period;
| xref:BloombergLP/bslalg/DequePrimitives-01.adoc[`DequePrimitives`] 
| This `struct` provides a namespace for a suite of utility functions that operate on deques parameterized by the `VALUE&lowbar;TYPE` and `BLOCK&lowbar;LENGTH`&period; Depending on the traits of `VALUE&lowbar;TYPE`, the default and copy constructors, destructor, assignment operators, etcetera may not be invoked, and instead the operation can be optimized using a no&hyphen;op, bitwise move, or bitwise copy&period;
| xref:BloombergLP/bslalg/DequePrimitives_DequeElementGuard.adoc[`DequePrimitives&lowbar;DequeElementGuard`] 
| This `class` provides a specialized proctor object that, upon destruction and unless the `release` method has been called, destroys the elements in a segment of a deque of parameterized `VALUE&lowbar;TYPE`&period; The elements destroyed are delimited by the &quot;guarded&quot; range `&lsqb;d&lowbar;begin &period;&period; d&lowbar;end)&rsqb;`&period;
| xref:BloombergLP/bslalg/DequePrimitives_DequeEndpointProctor.adoc[`DequePrimitives&lowbar;DequeEndpointProctor`] 
| This class implements a proctor that, upon destruction and unless its `release` method has previously been invoked, sets a deque endpoint (i&period;e&period;, &quot;start&quot; or &quot;finish&quot; iterator) to a position within the deque&period; Both the endpoint and position are supplied at construction&period; See `emplaceAndMoveToBack` and `emplaceAndMoveToFront` for use cases&period;
| xref:BloombergLP/bslalg/DequePrimitives_DequeMoveGuard.adoc[`DequePrimitives&lowbar;DequeMoveGuard`] 
| This `class` provides a guard object that, upon destruction and unless the `release` method has been called, uses `moveBack` or `moveFront` to move the &quot;guarded&quot; range `&lsqb;d&lowbar;source&lowbar;p &period;&period; d&lowbar;source&lowbar;p &plus; d&lowbar;size &hyphen; 1&rsqb;` back to `&lsqb;d&lowbar;destination&lowbar;p &period;&period; d&lowbar;destination&lowbar;p &plus; d&lowbar;size &hyphen;1&rsqb;`&period;
| xref:BloombergLP/bslalg/DequePrimitives_ExternalDequeElementGuard.adoc[`DequePrimitives&lowbar;ExternalDequeElementGuard`] 
| This `class` provides a specialized proctor object that, upon destruction and unless the `release` method has been called, destroys the elements in a segment of a `bsl&colon;&colon;deque` of parameterized type `VALUE&lowbar;TYPE`&period; The elements destroyed are delimited by the &quot;guarded&quot; range `&lsqb;&ast;d&lowbar;begin &period;&period; &ast;d&lowbar;end)&rsqb;`&period; Note that the range guarded by this `class` is dynamic and can be changed outside of this `class`&period;
| xref:BloombergLP/bslalg/FunctorAdapter-09.adoc[`FunctorAdapter`] 
| This class provides a metafunction that defines an alias `Type` for the parameterized `CALLABLE&lowbar;OBJECT`&period; `Type` is functor type that provides the same operation as the parameterized `CALLABLE&lowbar;OBJECT`&period; Note that function pointers are supported through a specialization of this template&period;
| xref:BloombergLP/bslalg/FunctorAdapter_FunctionPointer.adoc[`FunctorAdapter&lowbar;FunctionPointer`] 
| This class provides a functor that delegates to the function referred to by a function pointer supplied on construction&period; Delegation is supported through the conversion operator, which implicitly returns a reference to the parameterized `FUNCTION&lowbar;POINTER`&period;
| xref:BloombergLP/bslalg/HasStlIterators-0e.adoc[`HasStlIterators`] 
| This class detects if the specified class `TYPE` has STL&hyphen;like iterators&period; If the class `TYPE` provides STL&hyphen;like iterators then `HasStlIterators&lt;TYPE&gt;&colon;&colon;value &equals;&equals; true`, and `HasStlIterators&lt;TYPE&gt;&colon;&colon;value &equals;&equals; false` otherwise&period;
| xref:BloombergLP/bslalg/HasTrait.adoc[`HasTrait`] 
| This meta&hyphen;function evaluates to `bsl&colon;&colon;true&lowbar;type` if the (template parameter) `TYPE` has the (template parameter) `TRAIT`, and to `bsl&colon;&colon;false&lowbar;type` otherwise&period;
| xref:BloombergLP/bslalg/HashTableAnchor.adoc[`HashTableAnchor`] 
| This complex constrained _in_&hyphen;_core_ (value&hyphen;semantic) attribute class characterizes the key data elements of a hash table&period; See the  section information on the class attributes&period; Note that the class invariant is the identically the complex constraint of this component&period;
| xref:BloombergLP/bslalg/HashTableBucket.adoc[`HashTableBucket`] 
| 
| xref:BloombergLP/bslalg/HashTableImpUtil.adoc[`HashTableImpUtil`] 
| This `struct` provides a namespace for a suite of utility functions for creating and manipulating a hash table&period;
| xref:BloombergLP/bslalg/HashTableImpUtil_ExtractKeyResult.adoc[`HashTableImpUtil&lowbar;ExtractKeyResult`] 
| Metafunction that deduces the return type of `KEY&lowbar;CONFIG&colon;&colon;extractKey`&period;
| xref:BloombergLP/bslalg/HashUtil.adoc[`HashUtil`] 
| This `struct` provides a namespace for hash functions&period;
| xref:BloombergLP/bslalg/NothrowMovableUtil.adoc[`NothrowMovableUtil`] 
| Namesapace for `NothrowMovableWrapper` traits and utilities&period;
| xref:BloombergLP/bslalg/NothrowMovableUtil_Traits-04.adoc[`NothrowMovableUtil&lowbar;Traits`] 
| Metafunction providing traits for `NothrowMovableWrapper` types&period;
| xref:BloombergLP/bslalg/NothrowMovableWrapper-02.adoc[`NothrowMovableWrapper`] 
| An object of this type wraps a value of the specified `TYPE`, and provides no other functionality other than returning the wrapped object&period; The move constructor is guaranteed not to throw, even if the move constructor for `TYPE` has no such guarantee&period; The user is thus asserting that the move constructor for the wrapped object _will not_ throw, even if it is allowed to&period; Constraints&colon; this class can be instantiated on object types only, i&period;e&period;, not references, arrays, or function types (though function pointers are OK)&period;
| xref:BloombergLP/bslalg/NumericFormatterUtil.adoc[`NumericFormatterUtil`] 
| Namespace `struct` for free functions supporting `to&lowbar;chars`&period;
| xref:BloombergLP/bslalg/RangeCompare.adoc[`RangeCompare`] 
| This utility `struct` provides two static class methods, `equal` and `lexicographical`, for comparing two ranges of values&period; `equal` returns `true` if each element in one range has the same value as the corresponding element in the other range, and `false` otherwise&period; `lexicographical` returns 0 if the two ranges are equal, a positive value if the first range is greater than the second, and a negative value if the second range is greater than the first&period; A range is specified by a pair of beginning and ending iterators, with an optional length parameter&period; Additionally, an overload is provided for the `equal` class method that allows the end iterator for one range to be omitted&period;
| xref:BloombergLP/bslalg/RbTreeAnchor.adoc[`RbTreeAnchor`] 
| An `RbTreeAnchor` provides the addresses of the first and root nodes of a binary search tree&period; An `RbTreeAnchor` is similar to an in&hyphen;core simply constrained (value&hyphen;semantic) attribute class, except that it does not supply equality&hyphen;comparison, copy&hyphen;construction, and copy&hyphen;assignment operations&period; Note that a node may not be copied because `sentinel` returns an address unique to each `RbTreeAnchor` object&period;
| xref:BloombergLP/bslalg/RbTreeNode.adoc[`RbTreeNode`] 
| This POD&hyphen;like `class` describes a node suitable for use in a red&hyphen;black binary search tree, holding the addresses of the parent, left&hyphen;child, and right&hyphen;child nodes (any of which may be 0), as well as a &quot;color&quot; (red or black)&period; This class is a &quot;POD&hyphen;like&quot; to facilitate efficient allocation and use in the context of a container implementation&period; In order to meet the essential requirements of a POD type, this `class` does not define a constructor or destructor&period; However its data members are private&period; Since this class will be aligned to a word boundary, a pointer type will be a multiple of 4&period; This class use this property to reduce its size by storing the color information in the least significant bit of the parent pointer&period; Note that this type does not contain any &quot;payload&quot; member data&colon; Clients creating a red&hyphen;black binary search tree must define an appropriate node type that incorporates `RbTreeNode` (generally via inheritance), and that holds the &quot;key&quot; value and any associated data&period;
| xref:BloombergLP/bslalg/RbTreeUtil.adoc[`RbTreeUtil`] 
| This `struct` provides a namespace for a suite of utility functions that operate on elements of type `RbTreeNode`&period;
| xref:BloombergLP/bslalg/RbTreeUtilTreeProctor.adoc[`RbTreeUtilTreeProctor`] 
| This class implements a proctor that, unless `release` is called, invokes the parameterized `DELETER` on each node in the tree supplied at construction&period;
| xref:BloombergLP/bslalg/RbTreeUtil_Validator.adoc[`RbTreeUtil&lowbar;Validator`] 
| This `struct` provides a namespace for auxiliary functions used to validate a red&hyphen;black binary search tree&period;
| xref:BloombergLP/bslalg/ScalarPrimitives.adoc[`ScalarPrimitives`] 
| This `struct` provides a namespace for a suite of utility functions that operate on elements of a parameterized type `TARGET&lowbar;TYPE`&period; If any of the `&period;&period;&period;Construct` methods throws, then its target `address` is left uninitialized and there are no effects, unless otherwise mentioned in the documentation&period;
| xref:BloombergLP/bslalg/SelectTrait.adoc[`SelectTrait`] 
| Select one trait out of several that the parameterized type `T` may possess&period; If `T` has the parameterized trait `TRAIT1`, then the nested `Type` is `TRAIT1`, else if `T` has an optionally parameterized `TRAIT2`, then `Type` is `TRAIT2`, etc&period; Also computes an integral selection constant and meta&hyphen;value&period; If `T` has none of the parameterized `TRAIT&ast;`, then the nested `Type` is `TypeTraitNil`&period;
| xref:BloombergLP/bslalg/SwapUtil.adoc[`SwapUtil`] 
| This class provides a namespace for the `swap` utility method&period;
| xref:BloombergLP/bslalg/SynthThreeWayUtil.adoc[`SynthThreeWayUtil`] 
| &quot;Exposition&hyphen;only&quot; part of `bslstl&lowbar;compare&period;h`
| xref:BloombergLP/bslalg/TypeTraitBitwiseCopyable.adoc[`TypeTraitBitwiseCopyable`] 
| Objects of a type with this trait can be copied using `memcpy`&period; After such a bitwise copy, both the original and the copy are valid&period; Classes with this trait are assumed to have trivial (no&hyphen;op) destructors and are assumed to be bitwise moveable (see the `TypeTraitBitwiseMoveable` trait)&period; Undefined behavior may result if this trait is assigned to a type that allocates memory or other resources, uses virtual inheritance, or places pointers to itself within other data structures&period; Also, objects of a type with this trait can be destroyed by a no&hyphen;op, i&period;e&period;, not invoking the destructor, although it is safe to write zeros into the memory footprint of the object&period;
| xref:BloombergLP/bslalg/TypeTraitBitwiseEqualityComparable.adoc[`TypeTraitBitwiseEqualityComparable`] 
| Objects of a type with this trait can be compared for equality using `memcmp`&period; If two objects compare equal, then `memcmp` returns 0, otherwise it returns non&hyphen;zero&period; Classes with this traits are assumed to have no padding and to be bit&hyphen;wise copyable (see the `TypeTraitBitwiseCopyable` trait)&period; Undefined behavior may result if this trait is assigned to a type that does not have an `operator&equals;&equals;` or whose `operator&equals;&equals;` implementation may return different from comparing the footprints with `memcmp` &period;
| xref:BloombergLP/bslalg/TypeTraitBitwiseMoveable.adoc[`TypeTraitBitwiseMoveable`] 
| Objects of a type with this trait can be &quot;moved&quot; from one memory location to another using `memmove` or `memcpy`&period; Although the result of such a bitwise copy is two copies of the same object, this trait only guarantees that one of the copies can be destroyed&period; The other copy must be considered invalid and its destructor must not be called&period; Most types, even those that contain pointers, are bitwise moveable&period; Undefined behavior may result if this trait is assigned to a types that contains pointers to its own internals, use virtual inheritance, or places pointers to itself within other data structures&period;
| xref:BloombergLP/bslalg/TypeTraitHasPointerSemantics.adoc[`TypeTraitHasPointerSemantics`] 
| A type with this trait is said to have &quot;pointer semantics&quot;&period; That is the type behaves as if it were a fundamental pointer type&period; The type must define(at a minimum) `operator&ast;` and `operator&hyphen;&gt;`&period; Note that simply providing the above operators does not imply that a type has pointer semantics&period; This trait is intended for &quot;wrapper&quot; types that behave as pointers&period; Some examples of such types include `std&colon;&colon;auto&lowbar;ptr`, and `bslma&colon;&colon;ManagedPtr`&period; This trait is generally used by objects that invoke the wrapped type&period;
| xref:BloombergLP/bslalg/TypeTraitHasStlIterators.adoc[`TypeTraitHasStlIterators`] 
| A `TYPE` with this trait defines (at minimum) the nested types `iterator` and `const&lowbar;iterator` and the functions `begin()` and `end()` having the standard STL semantics&period;
| xref:BloombergLP/bslalg/TypeTraitHasTrivialDefaultConstructor.adoc[`TypeTraitHasTrivialDefaultConstructor`] 
| A `TYPE` with this trait has a trivial default constructor&period; Objects of a type with this trait can be default&hyphen;initialized by simply writing zeros into the memory footprint of the object&period; Although it is possible for such a type not to be bitwise copyable, undefined behavior may result if this trait is assigned to such a type&period; (See the description of `TypeTraitBitwiseCopyable`&period;)
| xref:BloombergLP/bslalg/TypeTraitNil.adoc[`TypeTraitNil`] 
| Nil trait &hyphen;&hyphen; every type has this trait&period;
| xref:BloombergLP/bslalg/TypeTraitPair.adoc[`TypeTraitPair`] 
| A `TYPE` with this trait has two data members, `first` and `second` of types `T&colon;&colon;first&lowbar;type` and `T&colon;&colon;second&lowbar;type`, respectively&period;
| xref:BloombergLP/bslalg/TypeTraitUsesBslmaAllocator.adoc[`TypeTraitUsesBslmaAllocator`] 
| A `TYPE` with this trait uses an allocator derived from `bslma&colon;&colon;Allocator` to supply memory&period; See documentation on the `bslma&lowbar;usesbslmaallocator` trait for the requirements on a `TYPE` that has this trait&period;
|===


== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslalg/ScalarDestructionPrimitives.adoc[`ScalarDestructionPrimitives`] 
| This alias is defined for backward compatibility&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslalg/_04enum.adoc[`Unnamed enum`] 
| These constants are used in the overloads below, when the last argument is of type &apos;bsl&colon;&colon;integral&lowbar;constant&lt;int, N&gt;&apos;, indicating that &apos;VALUE&lowbar;TYPE&apos; has the traits for which the enumerator equal to &apos;N&apos; is named&period; Workaround for windows&period; The windows compiler refuses to recognize enum declarations within a class template&period;
|===


== Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslalg/swap.adoc[`swap`] 
| Efficiently exchange the values of the specified `a` and `b` objects&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee&period; The behavior is undefined unless the two objects were created with the same allocator&period;
| xref:BloombergLP/bslalg/operator_eq-0b.adoc[`operator&equals;&equals;`] 
| Equality operators
| xref:BloombergLP/bslalg/operator_not_eq-03.adoc[`operator!&equals;`] 
| Inequality operators
| xref:BloombergLP/bslalg/operator_3way-04.adoc[`operator&lt;&equals;&gt;`] 
| Three&hyphen;way comparison operators
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
