Bayesian Filtering Library  Generated from SVN r
Modules
Utilities

Modules

 Function Objects
 
 Memory
 

Unformatted Output Functions

namespace std _GLIBCXX_VISIBILITY (default)
 

Detailed Description

Components deemed generally useful. Includes pair, tuple, forward/move helpers, ratio, function object, metaprogramming and type traits, time, date, and memory functions.

Function Documentation

§ _GLIBCXX_VISIBILITY()

namespace std _GLIBCXX_VISIBILITY ( default  )

Type used by fpos, char_traits<char>, and char_traits<wchar_t>.

In clauses 21.1.3.1 and 27.4.1 streamoff is described as an implementation defined type. Note: In versions of GCC up to and including GCC 3.3, streamoff was typedef long.

Integral type for I/O operation counts and buffer sizes.

Class representing stream positions.

The standard places no requirements upon the template parameter StateT. In this implementation StateT must be DefaultConstructible, CopyConstructible and Assignable. The standard only requires that fpos should contain a member of type StateT. In this implementation it also contains an offset stored as a signed integer.

Parameters
StateTType passed to and returned from state().

Construct position from offset.

Convert to streamoff.

Remember the value of st.

Return the last set value of st.

Add offset to this position.

Subtract offset from this position.

Add position and offset.

Subtract offset from position.

Subtract position to return offset.

Test if equivalent to another position.

File position for char streams.

File position for wchar_t streams.

Same as C++11 std::addressof

A generalization of pointer arithmetic.

Parameters
__firstAn input iterator.
__lastAn input iterator.
Returns
The distance between them.

Returns n such that __first + n == __last. This requires that __last must be reachable from __first. Note that n may be negative.

For random access iterators, this uses their + and - operations and are constant time. For other iterator classes they are linear time.

A generalization of pointer arithmetic.

Parameters
__iAn input iterator.
__nThe delta by which to change __i.
Returns
Nothing.

This increments i by n. For bidirectional and random access iterators, __n may be negative, in which case __i is decremented.

For random access iterators, this uses their + and - operations and are constant time. For other iterator classes they are linear time.

Swaps the contents of two iterators.

Parameters
__aAn iterator.
__bAnother iterator.
Returns
Nothing.

This function swaps the values pointed to by two iterators, not the iterators themselves.

Swap the elements of two sequences.

Parameters
__first1A forward iterator.
__last1A forward iterator.
__first2A forward iterator.
Returns
An iterator equal to first2+(last1-first1).

Swaps each element in the range [first1,last1) with the corresponding element in the range [first2,(last1-first1)). The ranges must not overlap.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
Returns
The lesser of the parameters.

This is the simple classic generic implementation. It will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
Returns
The greater of the parameters.

This is the simple classic generic implementation. It will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
__compA comparison functor.
Returns
The lesser of the parameters.

This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
__compA comparison functor.
Returns
The greater of the parameters.

This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

Copies the range [first,last) into result.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
result + (first - last)

This inline function will boil down to a call to memmove whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling). Result may not be contained within [first,last); the copy_backward function should be used instead.

Note that the end of the output range is permitted to be contained within [first,last).

Copies the range [first,last) into result.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
__resultA bidirectional iterator.
Returns
result - (first - last)

The function has the same effect as copy, but starts at the end of the range and works its way to the start, returning the start of the result. This inline function will boil down to a call to memmove whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling).

Result may not be in the range (first,last]. Use copy instead. Note that the start of the output range may overlap [first,last).

Fills the range [first,last) with copies of value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__valueA reference-to-const of arbitrary type.
Returns
Nothing.

This function fills a range with copies of the same value. For char types filling contiguous areas of memory, this becomes an inline call to memset or wmemset.

Fills the range [first,first+n) with copies of value.

Parameters
__firstAn output iterator.
__nThe count of copies to perform.
__valueA reference-to-const of arbitrary type.
Returns
The iterator at first+n.

This function fills a range with copies of the same value. For char types filling contiguous areas of memory, this becomes an inline call to memset or @ wmemset.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 865. More algorithms that throw away information

Finds the first position in which val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
An iterator pointing to the first element not less than val, or end() if every element is less than val.

This is a helper function for the sort routines and for random.tcc.

Tests a range for element-wise equality.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
Returns
A boolean true or false.

This compares the elements of two ranges using == and returns true or false depending on whether all of the corresponding elements of the ranges are equal.

Tests a range for element-wise equality.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__binary_predA binary predicate functor.
Returns
A boolean true or false.

This compares the elements of two ranges using the binary_pred parameter, and returns true or false depending on whether all of the corresponding elements of the ranges are equal.

Performs dictionary comparison on ranges.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__last2An input iterator.
Returns
A boolean true or false.

Returns true if the sequence of elements defined by the range [first1,last1) is lexicographically less than the sequence of elements defined by the range [first2,last2). Returns false otherwise. (Quoted from [25.3.8]/1.) If the iterators are all character pointers, then this is an inline call to memcmp.

Performs dictionary comparison on ranges.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__last2An input iterator.
__compA comparison functor.
Returns
A boolean true or false.

The same as the four-parameter lexicographical_compare, but uses the comp parameter instead of <.

Finds the places in ranges which don't match.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
Returns
A pair of iterators pointing to the first mismatch.

This compares the elements of two ranges using == and returns a pair of iterators. The first iterator points into the first range, the second iterator points into the second range, and the elements pointed to by the iterators are not equal.

Finds the places in ranges which don't match.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__binary_predA binary predicate functor.
Returns
A pair of iterators pointing to the first mismatch.

This compares the elements of two ranges using the binary_pred parameter, and returns a pair of iterators. The first iterator points into the first range, the second iterator points into the second range, and the elements pointed to by the iterators are not equal.

Mapping from character type to associated types.

Note
This is an implementation class for the generic version of char_traits. It defines int_type, off_type, pos_type, and state_type. By default these are unsigned long, streamoff, streampos, and mbstate_t. Users who need a different set of types, but who don't need to change the definitions of any function defined in char_traits, can specialize __gnu_cxx::_Char_types while leaving __gnu_cxx::char_traits alone.

Base class used to implement std::char_traits.

Note
For any given actual character type, this definition is probably wrong. (Most of the member functions are likely to be right, but the int_type and state_type typedefs, and the eof() member function, are likely to be wrong.) The reason this class exists is so users can specialize it. Classes in namespace std may not be specialized for fundamental types, but classes in namespace __gnu_cxx may be.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types for advice on how to make use of this class for unusual character types. Also, check out include/ext/pod_char_traits.h.

Basis for explicit traits specializations.

Note
For any given actual character type, this definition is probably wrong. Since this is just a thin wrapper around __gnu_cxx::char_traits, it is possible to achieve a more appropriate definition by specializing __gnu_cxx::char_traits.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types for advice on how to make use of this class for unusual character types. Also, check out include/ext/pod_char_traits.h.

21.1.3.1 char_traits specializations

21.1.3.2 char_traits specializations

An allocator that uses global new, as per [20.4].

This is precisely the allocator defined in the C++ Standard.

  • all allocation calls operator new
  • all deallocation calls operator delete
Template Parameters
_TpType of allocated object.

Uniform interface to C++98 and C++11 allocators.

Container class for localization functionality.

The locale class is first a class wrapper for C library locales. It is also an extensible container for user-defined localization. A locale is a collection of facets that implement various localization features such as money, time, and number printing.

Constructing C++ locales does not change the C library locale.

This library supports efficient construction and copying of locales through a reference counting implementation of the locale class.

Definition of locale::category.

Category values.

The standard category values are none, ctype, numeric, collate, time, monetary, and messages. They form a bitmask that supports union and intersection. The category all is the union of these values.

NB: Order must match _S_facet_categories definition in locale.cc

Default constructor.

Constructs a copy of the global locale. If no locale has been explicitly set, this is the C locale.

Copy constructor.

Constructs a copy of other.

Parameters
__otherThe locale to copy.

Named locale constructor.

Constructs a copy of the named C library locale.

Parameters
__sName of the locale to construct.
Exceptions
std::runtime_errorif __s is null or an undefined locale.

Construct locale with facets from another locale.

Constructs a copy of the locale base. The facets specified by cat are replaced with those from the locale named by s. If base is named, this locale instance will also be named.

Parameters
__baseThe locale to copy.
__sName of the locale to use facets from.
__catSet of categories defining the facets to use from __s.
Exceptions
std::runtime_errorif __s is null or an undefined locale.

Construct locale with facets from another locale.

Constructs a copy of the locale base. The facets specified by cat are replaced with those from the locale add. If base and add are named, this locale instance will also be named.

Parameters
__baseThe locale to copy.
__addThe locale to use facets from.
__catSet of categories defining the facets to use from add.

Construct locale with another facet.

Constructs a copy of the locale __other. The facet __f is added to __other, replacing an existing facet of type Facet if there is one. If __f is null, this locale is a copy of __other.

Parameters
__otherThe locale to copy.
__fThe facet to add in.

Locale destructor.

Assignment operator.

Set this locale to be a copy of other.

Parameters
__otherThe locale to copy.
Returns
A reference to this locale.

Construct locale with another facet.

Constructs and returns a new copy of this locale. Adds or replaces an existing facet of type Facet from the locale other into the new locale.

Template Parameters
_FacetThe facet type to copy from other
Parameters
__otherThe locale to copy from.
Returns
Newly constructed locale.
Exceptions
std::runtime_errorif __other has no facet of type _Facet.

Return locale name.

Returns
Locale name or "*" if unnamed.

Locale equality.

Parameters
__otherThe locale to compare against.
Returns
True if other and this refer to the same locale instance, are copies, or have the same name. False otherwise.

Locale inequality.

Parameters
__otherThe locale to compare against.
Returns
! (*this == __other)

Compare two strings according to collate.

Template operator to compare two strings using the compare function of the collate facet in this locale. One use is to provide the locale to the sort function. For example, a vector v of strings could be sorted according to locale loc by doing:

std::sort(v.begin(), v.end(), loc);
Parameters
__s1First string to compare.
__s2Second string to compare.
Returns
True if collate<_Char> facet compares __s1 < __s2, else false.

Set global locale

This function sets the global locale to the argument and returns a copy of the previous global locale. If the argument has a name, it will also call std::setlocale(LC_ALL, loc.name()).

Parameters
__locThe new locale to make global.
Returns
Copy of the old global locale.

Return reference to the C locale.

Localization functionality base class.

The facet class is the base class for a localization feature, such as money, time, and number printing. It provides common support for facets and reference management.

Facets may not be copied or assigned.

Facet constructor.

This is the constructor provided by the standard. If refs is 0, the facet is destroyed when the last referencing locale is destroyed. Otherwise the facet will never be destroyed.

Parameters
__refsThe initial value for reference count.

Facet destructor.

Facet ID class.

The ID class provides facets with an index used to identify them. Every facet class must define a public static member locale::id, or be derived from a facet that provides this member, otherwise the facet cannot be used in a locale. The locale::id ensures that each class type gets a unique identifier.

Constructor.

Facet for localized string comparison.

This facet encapsulates the code to compare strings in a localized manner.

The collate template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the collate facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__refsPassed to the base facet class.

Compare two strings.

This function compares two strings and returns the result by calling collate::do_compare().

Parameters
__lo1Start of string 1.
__hi1End of string 1.
__lo2Start of string 2.
__hi2End of string 2.
Returns
1 if string1 > string2, -1 if string1 < string2, else 0.

Transform string to comparable form.

This function is a wrapper for strxfrm functionality. It takes the input string and returns a modified string that can be directly compared to other transformed strings. In the C locale, this function just returns a copy of the input string. In some other locales, it may replace two chars with one, change a char for another, etc. It does so by returning collate::do_transform().

Parameters
__loStart of string.
__hiEnd of string.
Returns
Transformed string_type.

Return hash of a string.

This function computes and returns a hash on the input string. It does so by returning collate::do_hash().

Parameters
__loStart of string.
__hiEnd of string.
Returns
Hash value.

Destructor.

Compare two strings.

This function is a hook for derived classes to change the value returned.

See also
compare().
Parameters
__lo1Start of string 1.
__hi1End of string 1.
__lo2Start of string 2.
__hi2End of string 2.
Returns
1 if string1 > string2, -1 if string1 < string2, else 0.

Transform string to comparable form.

This function is a hook for derived classes to change the value returned.

Parameters
__loStart.
__hiEnd.
Returns
transformed string.

Return hash of a string.

This function computes and returns a hash on the input string. This function is a hook for derived classes to change the value returned.

Parameters
__loStart of string.
__hiEnd of string.
Returns
Hash value.

class collate_byname [22.2.4.2].

Public typedefs

Test for the presence of a facet.

has_facet tests the locale argument for the presence of the facet type provided as the template parameter. Facets derived from the facet parameter will also return true.

Template Parameters
_FacetThe facet type to test the presence of.
Parameters
__locThe locale to test.
Returns
true if __loc contains a facet of type _Facet, else false.

Return a facet.

use_facet looks for and returns a reference to a facet of type Facet where Facet is the template parameter. If has_facet(locale) is true, there is a suitable facet to return. It throws std::bad_cast if the locale doesn't contain a facet of type Facet.

Template Parameters
_FacetThe facet type to access.
Parameters
__locThe locale to use.
Returns
Reference to facet of type Facet.
Exceptions
std::bad_castif __loc doesn't contain a facet of type _Facet.

The base of the I/O class hierarchy.

This class defines everything that can be defined about I/O that does not depend on the type of characters being input or output. Most people will only see ios_base when they need to specify the full name of the various I/O flags (e.g., the openmodes).

These are thrown to indicate problems with io.

27.4.2.1.1 Class ios_base::failure

This is a bitmask type.

_Ios_Fmtflags is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type fmtflags are:

  • boolalpha
  • dec
  • fixed
  • hex
  • internal
  • left
  • oct
  • right
  • scientific
  • showbase
  • showpoint
  • showpos
  • skipws
  • unitbuf
  • uppercase
  • adjustfield
  • basefield
  • floatfield

Insert/extract bool in alphabetic rather than numeric format.

Converts integer input or generates integer output in decimal base.

Generate floating-point output in fixed-point notation.

Converts integer input or generates integer output in hexadecimal base.

Adds fill characters at a designated internal point in certain generated output, or identical to right if no such point is designated.

Adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.)

Converts integer input or generates integer output in octal base.

Adds fill characters on the left (initial positions) of certain generated output. (I.e., the thing you print is flush right.)

Generates floating-point output in scientific notation.

Generates a prefix indicating the numeric base of generated integer output.

Generates a decimal-point character unconditionally in generated floating-point output.

Generates a + sign in non-negative generated numeric output.

Skips leading white space before certain input operations.

Flushes output after each output operation.

Replaces certain lowercase letters with their uppercase equivalents in generated output.

A mask of left|right|internal. Useful for the 2-arg form of setf.

A mask of dec|oct|hex. Useful for the 2-arg form of setf.

A mask of scientific|fixed. Useful for the 2-arg form of setf.

This is a bitmask type.

_Ios_Iostate is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type iostate are:

  • badbit
  • eofbit
  • failbit
  • goodbit

Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file).

Indicates that an input operation reached the end of an input sequence.

Indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters.

Indicates all is well.

This is a bitmask type.

_Ios_Openmode is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type openmode are:

  • app
  • ate
  • binary
  • in
  • out
  • trunc

Seek to end before each write.

Open and seek to end immediately after opening.

Perform input and output in binary mode (as opposed to text mode). This is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary

Open for input. Default for ifstream and fstream.

Open for output. Default for ofstream and fstream.

Open for input. Default for ofstream.

This is an enumerated type.

_Ios_Seekdir is implementation-defined. Defined values of type seekdir are:

  • beg
  • cur, equivalent to SEEK_CUR in the C standard library.
  • end, equivalent to SEEK_END in the C standard library.

Request a seek relative to the beginning of the stream.

Request a seek relative to the current position within the sequence.

Request a seek relative to the current end of the sequence.

The set of events that may be passed to an event callback.

erase_event is used during ~ios() and copyfmt(). imbue_event is used during imbue(). copyfmt_event is used during copyfmt().

The type of an event callback function.

Parameters
__eOne of the members of the event enum.
__bReference to the ios_base object.
__iThe integer provided when the callback was registered.

Event callbacks are user defined functions that get called during several ios_base and basic_ios functions, specifically imbue(), copyfmt(), and ~ios().

Add the callback __fn with parameter __index.

Parameters
__fnThe function to add.
__indexThe integer to pass to the function when invoked.

Registers a function as an event callback with an integer parameter to be passed to the function when invoked. Multiple copies of the function are allowed. If there are multiple callbacks, they are invoked in the order they were registered.

Access to format flags.

Returns
The format control flags for both input and output.

Setting new format flags all at once.

Parameters
__fmtflThe new flags to set.
Returns
The previous format control flags.

This function overwrites all the format flags with __fmtfl.

Setting new format flags.

Parameters
__fmtflAdditional flags to set.
Returns
The previous format control flags.

This function sets additional flags in format control. Flags that were previously set remain set.

Setting new format flags.

Parameters
__fmtflAdditional flags to set.
__maskThe flags mask for fmtfl.
Returns
The previous format control flags.

This function clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield.

Clearing format flags.

Parameters
__maskThe flags to unset.

This function clears __mask in the format flags.

Flags access.

Returns
The precision to generate on certain output operations.

Be careful if you try to give a definition of precision here; see DR 189.

Changing flags.

Parameters
__precThe new precision value.
Returns
The previous value of precision().

Flags access.

Returns
The minimum field width to generate on output operations.

Minimum field width refers to the number of characters.

Changing flags.

Parameters
__wideThe new width value.
Returns
The previous value of width().

Interaction with the standard C I/O objects.

Parameters
__syncWhether to synchronize or not.
Returns
True if the standard streams were previously synchronized.

The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary

Setting a new locale.

Parameters
__locThe new locale.
Returns
The previous locale.

Sets the new locale for this stream, and then invokes each callback with imbue_event.

Locale access

Returns
A copy of the current locale.

If imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale.

Locale access

Returns
A reference to the current locale.

Like getloc above, but returns a reference instead of generating a copy.

Access to unique indices.

Returns
An integer different from all previous calls.

This function returns a unique integer every time it is called. It can be used for any purpose, but is primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict.

The implementation maintains a static variable that is incremented and returned on each invocation. xalloc is guaranteed to return an index that is safe to use in the iword and pword arrays.

Access to integer array.

Parameters
__ixIndex into the array.
Returns
A reference to an integer associated with the index.

The iword function provides access to an array of integers that can be used for any purpose. The array grows as required to hold the supplied index. All integers in the array are initialized to 0.

The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference.

Access to void pointer array.

Parameters
__ixIndex into the array.
Returns
A reference to a void* associated with the index.

The pword function provides access to an array of pointers that can be used for any purpose. The array grows as required to hold the supplied index. All pointers in the array are initialized to 0.

The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference.

Invokes each callback with erase_event. Destroys local storage.

Note that the ios_base object for the standard streams never gets destroyed. As a result, any callbacks registered with the standard streams will not get invoked with erase_event (unless copyfmt is used).

Calls base.setf(ios_base::boolalpha).

Calls base.unsetf(ios_base::boolalpha).

Calls base.setf(ios_base::showbase).

Calls base.unsetf(ios_base::showbase).

Calls base.setf(ios_base::showpoint).

Calls base.unsetf(ios_base::showpoint).

Calls base.setf(ios_base::showpos).

Calls base.unsetf(ios_base::showpos).

Calls base.setf(ios_base::skipws).

Calls base.unsetf(ios_base::skipws).

Calls base.setf(ios_base::uppercase).

Calls base.unsetf(ios_base::uppercase).

Calls base.setf(ios_base::unitbuf).

Calls base.unsetf(ios_base::unitbuf).

Calls base.setf(ios_base::internal, ios_base::adjustfield).

Calls base.setf(ios_base::left, ios_base::adjustfield).

Calls base.setf(ios_base::right, ios_base::adjustfield).

Calls base.setf(ios_base::dec, ios_base::basefield).

Calls base.setf(ios_base::hex, ios_base::basefield).

Calls base.setf(ios_base::oct, ios_base::basefield).

Calls base.setf(ios_base::fixed, ios_base::floatfield).

Calls base.setf(ios_base::scientific, ios_base::floatfield).

The actual work of input and output (interface).

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.

This is a base class. Derived stream buffers each control a pair of character sequences: one for input, and one for output.

Section [27.5.1] of the standard describes the requirements and behavior of stream buffer classes. That section (three paragraphs) is reproduced here, for simplicity and accuracy.

  1. Stream buffers can impose various constraints on the sequences they control. Some constraints are:
    • The controlled input sequence can be not readable.
    • The controlled output sequence can be not writable.
    • The controlled sequences can be associated with the contents of other representations for character sequences, such as external files.
    • The controlled sequences can support operations directly to or from associated sequences.
    • The controlled sequences can impose limitations on how the program can read characters from a sequence, write characters to a sequence, put characters back into an input sequence, or alter the stream position.
  2. Each sequence is characterized by three pointers which, if non-null, all point into the same charT array object. The array object represents, at any moment, a (sub)sequence of characters from the sequence. Operations performed on a sequence alter the values stored in these pointers, perform reads and writes directly to or from associated sequences, and alter the stream position and conversion state as needed to maintain this subsequence relationship. The three pointers are:
    • the beginning pointer, or lowest element address in the array (called xbeg here);
    • the next pointer, or next element address that is a current candidate for reading or writing (called xnext here);
    • the end pointer, or first element address beyond the end of the array (called xend here).
  3. The following semantic constraints shall always apply for any set of three pointers for a sequence, using the pointer names given immediately above:
    • If xnext is not a null pointer, then xbeg and xend shall also be non-null pointers into the same charT array, as described above; otherwise, xbeg and xend shall also be null.
    • If xnext is not a null pointer and xnext < xend for an output sequence, then a write position is available. In this case, *xnext shall be assignable as the next element to write (to put, or to store a character value, into the sequence).
    • If xnext is not a null pointer and xbeg < xnext for an input sequence, then a putback position is available. In this case, xnext[-1] shall have a defined value and is the next (preceding) element to store a character that is put back into the input sequence.
    • If xnext is not a null pointer and xnext< xend for an input sequence, then a read position is available. In this case, *xnext shall have a defined value and is the next element to read (to get, or to obtain a character value, from the sequence).

These are standard types. They permit a standardized way of referring to names of (or names dependent on) the template parameters, which are specific to the implementation.

This is a non-standard type.

< Start of get area.

< Current read area.

< End of get area.

< Start of put area.

< Current put area.

< End of put area.

Current locale setting.

Destructor deallocates no buffer space.

Entry point for imbue().

Parameters
__locThe new locale.
Returns
The previous locale.

Calls the derived imbue(__loc).

Locale access.

Returns
The current locale in effect.

If pubimbue(loc) has been called, then the most recent loc is returned. Otherwise the global locale in effect at the time of construction is returned.

Entry points for derived buffer functions.

The public versions of pubfoo dispatch to the protected derived foo member functions, passing the arguments (if any) and returning the result unchanged.

Alters the stream position.

Parameters
__offOffset.
__wayValue for ios_base::seekdir.
__modeValue for ios_base::openmode.

Calls virtual seekoff function.

Alters the stream position.

Parameters
__spPosition
__modeValue for ios_base::openmode.

Calls virtual seekpos function.

Calls virtual sync function.

Looking ahead into the stream.

Returns
The number of characters available.

If a read position is available, returns the number of characters available for reading before the buffer must be refilled. Otherwise returns the derived showmanyc().

Getting the next character.

Returns
The next character, or eof.

Calls sbumpc(), and if that function returns traits::eof(), so does this function. Otherwise, sgetc().

Getting the next character.

Returns
The next character, or eof.

If the input read position is available, returns that character and increments the read pointer, otherwise calls and returns uflow().

Getting the next character.

Returns
The next character, or eof.

If the input read position is available, returns that character, otherwise calls and returns underflow(). Does not move the read position after fetching the character.

Entry point for xsgetn.

Parameters
__sA buffer area.
__nA count.

Returns xsgetn(__s,__n). The effect is to fill __s[0] through __s[__n-1] with characters from the input sequence, if possible.

Pushing characters back into the input stream.

Parameters
__cThe character to push back.
Returns
The previous character, if possible.

Similar to sungetc(), but __c is pushed onto the stream instead of the previous character. If successful, the next character fetched from the input stream will be __c.

Moving backwards in the input stream.

Returns
The previous character, if possible.

If a putback position is available, this function decrements the input pointer and returns that character. Otherwise, calls and returns pbackfail(). The effect is to unget the last character gotten.

Entry point for all single-character output functions.

Parameters
__cA character to output.
Returns
__c, if possible.

One of two public output functions.

If a write position is available for the output sequence (i.e., the buffer is not full), stores __c in that position, increments the position, and returns traits::to_int_type(__c). If a write position is not available, returns overflow(__c).

Entry point for all single-character output functions.

Parameters
__sA buffer read area.
__nA count.

One of two public output functions.

Returns xsputn(__s,__n). The effect is to write __s[0] through __s[__n-1] to the output sequence, if possible.

Base constructor.

Only called from derived constructors, and sets up all the buffer data to zero, including the pointers described in the basic_streambuf class description. Note that, as a result,

  • the class starts with no read nor write positions available,
  • this is not an error

Access to the get area.

These functions are only available to other protected functions, including derived classes.

  • eback() returns the beginning pointer for the input sequence
  • gptr() returns the next pointer for the input sequence
  • egptr() returns the end pointer for the input sequence

Moving the read position.

Parameters
__nThe delta by which to move.

This just advances the read position without returning any data.

Setting the three read area pointers.

Parameters
__gbegA pointer.
__gnextA pointer.
__gendA pointer.
Postcondition
__gbeg == eback(), __gnext == gptr(), and __gend == egptr()

Access to the put area.

These functions are only available to other protected functions, including derived classes.

  • pbase() returns the beginning pointer for the output sequence
  • pptr() returns the next pointer for the output sequence
  • epptr() returns the end pointer for the output sequence

Moving the write position.

Parameters
__nThe delta by which to move.

This just advances the write position without returning any data.

Setting the three write area pointers.

Parameters
__pbegA pointer.
__pendA pointer.
Postcondition
__pbeg == pbase(), __pbeg == pptr(), and __pend == epptr()

Changes translations.

Parameters
__locA new locale.

Translations done during I/O which depend on the current locale are changed by this call. The standard adds, Between invocations of this function a class derived from streambuf can safely cache results of calls to locale functions and to members of facets so obtained.

Note
Base class version does nothing.

Manipulates the buffer.

Each derived class provides its own appropriate behavior. See the next-to-last paragraph of https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering for more on this function.

Note
Base class version does nothing, returns this.

Alters the stream positions.

Each derived class provides its own appropriate behavior.

Note
Base class version does nothing, returns a pos_type that represents an invalid stream position.

Alters the stream positions.

Each derived class provides its own appropriate behavior.

Note
Base class version does nothing, returns a pos_type that represents an invalid stream position.

Synchronizes the buffer arrays with the controlled sequences.

Returns
-1 on failure.

Each derived class provides its own appropriate behavior, including the definition of failure.

Note
Base class version does nothing, returns zero.

Investigating the data available.

Returns
An estimate of the number of characters available in the input sequence, or -1.

If it returns a positive value, then successive calls to underflow() will not return traits::eof() until at least that number of characters have been supplied. If showmanyc() returns -1, then calls to underflow() or uflow() will fail. [27.5.2.4.3]/1

Note
Base class version does nothing, returns zero.
The standard adds that the intention is not only that the calls [to underflow or uflow] will not return eof() but that they will return immediately.
The standard adds that the morphemes of showmanyc are es-how-many-see, not show-manic.

Multiple character extraction.

Parameters
__sA buffer area.
__nMaximum number of characters to assign.
Returns
The number of characters assigned.

Fills __s[0] through __s[__n-1] with characters from the input sequence, as if by sbumpc(). Stops when either __n characters have been copied, or when traits::eof() would be copied.

It is expected that derived classes provide a more efficient implementation by overriding this definition.

Fetches more data from the controlled sequence.

Returns
The first character from the pending sequence.

Informally, this function is called when the input buffer is exhausted (or does not exist, as buffering need not actually be done). If a buffer exists, it is refilled. In either case, the next available character is returned, or traits::eof() to indicate a null pending sequence.

For a formal definition of the pending sequence, see a good text such as Langer & Kreft, or [27.5.2.4.3]/7-14.

A functioning input streambuf can be created by overriding only this function (no buffer area will be used). For an example, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html

Note
Base class version does nothing, returns eof().

Fetches more data from the controlled sequence.

Returns
The first character from the pending sequence.

Informally, this function does the same thing as underflow(), and in fact is required to call that function. It also returns the new character, like underflow() does. However, this function also moves the read position forward by one.

Tries to back up the input sequence.

Parameters
__cThe character to be inserted back into the sequence.
Returns
eof() on failure, some other value on success
Postcondition
The constraints of gptr(), eback(), and pptr() are the same as for underflow().
Note
Base class version does nothing, returns eof().

Multiple character insertion.

Parameters
__sA buffer area.
__nMaximum number of characters to write.
Returns
The number of characters written.

Writes __s[0] through __s[__n-1] to the output sequence, as if by sputc(). Stops when either n characters have been copied, or when sputc() would return traits::eof().

It is expected that derived classes provide a more efficient implementation by overriding this definition.

Consumes data from the buffer; writes to the controlled sequence.

Parameters
__cAn additional character to consume.
Returns
eof() to indicate failure, something else (usually __c, or not_eof())

Informally, this function is called when the output buffer is full (or does not exist, as buffering need not actually be done). If a buffer exists, it is consumed, with some effect on the controlled sequence. (Typically, the buffer is written out to the sequence verbatim.) In either case, the character c is also written out, if __c is not eof().

For a formal definition of this function, see a good text such as Langer & Kreft, or [27.5.2.4.5]/3-7.

A functioning output streambuf can be created by overriding only this function (no buffer area will be used).

Note
Base class version does nothing, returns eof().

Tosses a character.

Advances the read pointer, ignoring the character that would have been read.

See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html

Base class for ctype.

Common base for ctype facet

This template class provides implementations of the public functions that forward to the protected virtual functions.

This template also provides abstract stubs for the protected virtual functions.

Typedef for the template parameter

Test char_type classification.

This function finds a mask M for __c and compares it to mask __m. It does so by returning the value of ctype<char_type>::do_is().

Parameters
__cThe char_type to compare the mask of.
__mThe mask to compare against.
Returns
(M & __m) != 0.

Return a mask array.

This function finds the mask for each char_type in the range [lo,hi) and successively writes it to vec. vec must have as many elements as the char array. It does so by returning the value of ctype<char_type>::do_is().

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__vecPointer to an array of mask storage.
Returns
__hi.

Find char_type matching a mask

This function searches for and returns the first char_type c in [lo,hi) for which is(m,c) is true. It does so by returning ctype<char_type>::do_scan_is().

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to matching char_type if found, else __hi.

Find char_type not matching a mask

This function searches for and returns the first char_type c in [lo,hi) for which is(m,c) is false. It does so by returning ctype<char_type>::do_scan_not().

Parameters
__mThe mask to compare against.
__loPointer to first char in range.
__hiPointer to end of range.
Returns
Pointer to non-matching char if found, else __hi.

Convert to uppercase.

This function converts the argument to uppercase if possible. If not possible (for example, '2'), returns the argument. It does so by returning ctype<char_type>::do_toupper().

Parameters
__cThe char_type to convert.
Returns
The uppercase char_type if convertible, else __c.

Convert array to uppercase.

This function converts each char_type in the range [lo,hi) to uppercase if possible. Other elements remain untouched. It does so by returning ctype<char_type>:: do_toupper(lo, hi).

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

Convert to lowercase.

This function converts the argument to lowercase if possible. If not possible (for example, '2'), returns the argument. It does so by returning ctype<char_type>::do_tolower(c).

Parameters
__cThe char_type to convert.
Returns
The lowercase char_type if convertible, else __c.

Convert array to lowercase.

This function converts each char_type in the range [__lo,__hi) to lowercase if possible. Other elements remain untouched. It does so by returning ctype<char_type>:: do_tolower(__lo, __hi).

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

Widen char to char_type

This function converts the char argument to char_type using the simplest reasonable transformation. It does so by returning ctype<char_type>::do_widen(c).

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char to convert.
Returns
The converted char_type.

Widen array to char_type

This function converts each char in the input to char_type using the simplest reasonable transformation. It does so by returning ctype<char_type>::do_widen(c).

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

Narrow char_type to char

This function converts the char_type to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead. It does so by returning ctype<char_type>::do_narrow(__c).

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char_type to convert.
__dfaultChar to return if conversion fails.
Returns
The converted char.

Narrow array to char array

This function converts each char_type in the input to char using the simplest reasonable transformation and writes the results to the destination array. For any char_type in the input that cannot be converted, dfault is used instead. It does so by returning ctype<char_type>::do_narrow(__lo, __hi, __dfault, __to).

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

Test char_type classification.

This function finds a mask M for c and compares it to mask m.

do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input.

Parameters
__cThe char_type to find the mask of.
__mThe mask to compare against.
Returns
(M & __m) != 0.

Return a mask array.

This function finds the mask for each char_type in the range [lo,hi) and successively writes it to vec. vec must have as many elements as the input.

do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__vecPointer to an array of mask storage.
Returns
__hi.

Find char_type matching mask

This function searches for and returns the first char_type c in [__lo,__hi) for which is(__m,c) is true.

do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a matching char_type if found, else __hi.

Find char_type not matching mask

This function searches for and returns a pointer to the first char_type c of [lo,hi) for which is(m,c) is false.

do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a non-matching char_type if found, else __hi.

Convert to uppercase.

This virtual function converts the char_type argument to uppercase if possible. If not possible (for example, '2'), returns the argument.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.

Parameters
__cThe char_type to convert.
Returns
The uppercase char_type if convertible, else __c.

Convert array to uppercase.

This virtual function converts each char_type in the range [__lo,__hi) to uppercase if possible. Other elements remain untouched.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

Convert to lowercase.

This virtual function converts the argument to lowercase if possible. If not possible (for example, '2'), returns the argument.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters
__cThe char_type to convert.
Returns
The lowercase char_type if convertible, else __c.

Convert array to lowercase.

This virtual function converts each char_type in the range [__lo,__hi) to lowercase if possible. Other elements remain untouched.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

Widen char

This virtual function converts the char to char_type using the simplest reasonable transformation.

do_widen() is a hook for a derived facet to change the behavior of widening. do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char to convert.
Returns
The converted char_type

Widen char array

This function converts each char in the input to char_type using the simplest reasonable transformation.

do_widen() is a hook for a derived facet to change the behavior of widening. do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

Narrow char_type to char

This virtual function converts the argument to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char_type to convert.
__dfaultChar to return if conversion fails.
Returns
The converted char.

Narrow char_type array to char

This virtual function converts each char_type in the range [__lo,__hi) to char using the simplest reasonable transformation and writes the results to the destination array. For any element in the input that cannot be converted, __dfault is used instead.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

Primary class template ctype facet.

This template class defines classification and conversion functions for character sets. It wraps cctype functionality. Ctype gets used by streams for many I/O operations.

This template provides the protected virtual functions the developer will have to replace in a derived class or specialization to make a working facet. The public functions that access them are defined in __ctype_abstract_base, to allow for implementation flexibility. See ctype<wchar_t> for an example. The functions are documented in __ctype_abstract_base.

Note: implementations are provided for all the protected virtual functions, but will likely not be useful.

The facet id for ctype<char_type>

The ctype<char> specialization.

This class defines classification and conversion functions for the char type. It gets used by char streams for many I/O operations. The char specialization provides a number of optimizations as well.

Typedef for the template parameter char.

The facet id for ctype<char>

The size of the mask table. It is SCHAR_MAX + 1.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__tableIf non-zero, table is used as the per-char mask. Else classic_table() is used.
__delIf true, passes ownership of table to this facet.
__refsPassed to the base facet class.

Constructor performs static initialization.

This constructor is used to construct the initial C locale facet.

Parameters
__clocHandle to C locale data.
__tableIf non-zero, table is used as the per-char mask.
__delIf true, passes ownership of table to this facet.
__refsPassed to the base facet class.

Test char classification.

This function compares the mask table[c] to __m.

Parameters
__cThe char to compare the mask of.
__mThe mask to compare against.
Returns
True if __m & table[__c] is true, false otherwise.

Return a mask array.

This function finds the mask for each char in the range [lo, hi) and successively writes it to vec. vec must have as many elements as the char array.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__vecPointer to an array of mask storage.
Returns
__hi.

Find char matching a mask

This function searches for and returns the first char in [lo,hi) for which is(m,char) is true.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a matching char if found, else __hi.

Find char not matching a mask

This function searches for and returns a pointer to the first char in [__lo,__hi) for which is(m,char) is false.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a non-matching char if found, else __hi.

Convert to uppercase.

This function converts the char argument to uppercase if possible. If not possible (for example, '2'), returns the argument.

toupper() acts as if it returns ctype<char>::do_toupper(c). do_toupper() must always return the same result for the same input.

Parameters
__cThe char to convert.
Returns
The uppercase char if convertible, else __c.

Convert array to uppercase.

This function converts each char in the range [__lo,__hi) to uppercase if possible. Other chars remain untouched.

toupper() acts as if it returns ctype<char>:: do_toupper(__lo, __hi). do_toupper() must always return the same result for the same input.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
Returns
__hi.

Convert to lowercase.

This function converts the char argument to lowercase if possible. If not possible (for example, '2'), returns the argument.

tolower() acts as if it returns ctype<char>::do_tolower(__c). do_tolower() must always return the same result for the same input.

Parameters
__cThe char to convert.
Returns
The lowercase char if convertible, else __c.

Convert array to lowercase.

This function converts each char in the range [lo,hi) to lowercase if possible. Other chars remain untouched.

tolower() acts as if it returns ctype<char>:: do_tolower(__lo, __hi). do_tolower() must always return the same result for the same input.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
Returns
__hi.

Widen char

This function converts the char to char_type using the simplest reasonable transformation. For an underived ctype<char> facet, the argument will be returned unchanged.

This function works as if it returns ctype<char>::do_widen(c). do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char to convert.
Returns
The converted character.

Widen char array

This function converts each char in the input to char using the simplest reasonable transformation. For an underived ctype<char> facet, the argument will be copied unchanged.

This function works as if it returns ctype<char>::do_widen(c). do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

Narrow char

This function converts the char to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead. For an underived ctype<char> facet, c will be returned unchanged.

This function works as if it returns ctype<char>::do_narrow(c). do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char to convert.
__dfaultChar to return if conversion fails.
Returns
The converted character.

Narrow char array

This function converts each char in the input to char using the simplest reasonable transformation and writes the results to the destination array. For any char in the input that cannot be converted, dfault is used instead. For an underived ctype<char> facet, the argument will be copied unchanged.

This function works as if it returns ctype<char>::do_narrow(lo, hi, dfault, to). do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

Returns a pointer to the mask table provided to the constructor, or the default from classic_table() if none was provided.

Returns a pointer to the C locale mask table.

Destructor.

This function deletes table() if del was true in the constructor.

Convert to uppercase.

This virtual function converts the char argument to uppercase if possible. If not possible (for example, '2'), returns the argument.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.

Parameters
__cThe char to convert.
Returns
The uppercase char if convertible, else __c.

Convert array to uppercase.

This virtual function converts each char in the range [lo,hi) to uppercase if possible. Other chars remain untouched.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

Convert to lowercase.

This virtual function converts the char argument to lowercase if possible. If not possible (for example, '2'), returns the argument.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters
__cThe char to convert.
Returns
The lowercase char if convertible, else __c.

Convert array to lowercase.

This virtual function converts each char in the range [lo,hi) to lowercase if possible. Other chars remain untouched.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
Returns
__hi.

Widen char

This virtual function converts the char to char using the simplest reasonable transformation. For an underived ctype<char> facet, the argument will be returned unchanged.

do_widen() is a hook for a derived facet to change the behavior of widening. do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char to convert.
Returns
The converted character.

Widen char array

This function converts each char in the range [lo,hi) to char using the simplest reasonable transformation. For an underived ctype<char> facet, the argument will be copied unchanged.

do_widen() is a hook for a derived facet to change the behavior of widening. do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

Narrow char

This virtual function converts the char to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead. For an underived ctype<char> facet, c will be returned unchanged.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char to convert.
__dfaultChar to return if conversion fails.
Returns
The converted char.

Narrow char array to char array

This virtual function converts each char in the range [lo,hi) to char using the simplest reasonable transformation and writes the results to the destination array. For any char in the input that cannot be converted, dfault is used instead. For an underived ctype<char> facet, the argument will be copied unchanged.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

The ctype<wchar_t> specialization.

This class defines classification and conversion functions for the wchar_t type. It gets used by wchar_t streams for many I/O operations. The wchar_t specialization provides a number of optimizations as well.

ctype<wchar_t> inherits its public methods from __ctype_abstract_base<wchar_t>.

Typedef for the template parameter wchar_t.

The facet id for ctype<wchar_t>

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Constructor performs static initialization.

This constructor is used to construct the initial C locale facet.

Parameters
__clocHandle to C locale data.
__refsPassed to the base facet class.

Destructor

Test wchar_t classification.

This function finds a mask M for c and compares it to mask m.

do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input.

Parameters
__cThe wchar_t to find the mask of.
__mThe mask to compare against.
Returns
(M & __m) != 0.

Return a mask array.

This function finds the mask for each wchar_t in the range [lo,hi) and successively writes it to vec. vec must have as many elements as the input.

do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__vecPointer to an array of mask storage.
Returns
__hi.

Find wchar_t matching mask

This function searches for and returns the first wchar_t c in [__lo,__hi) for which is(__m,c) is true.

do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a matching wchar_t if found, else __hi.

Find wchar_t not matching mask

This function searches for and returns a pointer to the first wchar_t c of [__lo,__hi) for which is(__m,c) is false.

do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a non-matching wchar_t if found, else __hi.

Convert to uppercase.

This virtual function converts the wchar_t argument to uppercase if possible. If not possible (for example, '2'), returns the argument.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.

Parameters
__cThe wchar_t to convert.
Returns
The uppercase wchar_t if convertible, else __c.

Convert array to uppercase.

This virtual function converts each wchar_t in the range [lo,hi) to uppercase if possible. Other elements remain untouched.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

Convert to lowercase.

This virtual function converts the argument to lowercase if possible. If not possible (for example, '2'), returns the argument.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters
__cThe wchar_t to convert.
Returns
The lowercase wchar_t if convertible, else __c.

Convert array to lowercase.

This virtual function converts each wchar_t in the range [lo,hi) to lowercase if possible. Other elements remain untouched.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

Widen char to wchar_t

This virtual function converts the char to wchar_t using the simplest reasonable transformation. For an underived ctype<wchar_t> facet, the argument will be cast to wchar_t.

do_widen() is a hook for a derived facet to change the behavior of widening. do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe char to convert.
Returns
The converted wchar_t.

Widen char array to wchar_t array

This function converts each char in the input to wchar_t using the simplest reasonable transformation. For an underived ctype<wchar_t> facet, the argument will be copied, casting each element to wchar_t.

do_widen() is a hook for a derived facet to change the behavior of widening. do_widen() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

Narrow wchar_t to char

This virtual function converts the argument to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead. For an underived ctype<wchar_t> facet, c will be cast to char and returned.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__cThe wchar_t to convert.
__dfaultChar to return if conversion fails.
Returns
The converted char.

Narrow wchar_t array to char array

This virtual function converts each wchar_t in the range [lo,hi) to char using the simplest reasonable transformation and writes the results to the destination array. For any wchar_t in the input that cannot be converted, dfault is used instead. For an underived ctype<wchar_t> facet, the argument will be copied, casting each element to char.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

Note: this is not what you want for codepage conversions. See codecvt for that.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

class ctype_byname [22.2.1.2].

22.2.1.4 Class ctype_byname specializations.

Primary class template numpunct.

This facet stores several pieces of information related to printing and scanning numbers, such as the decimal point character. It takes a template parameter specifying the char type. The numpunct facet is used by streams for many I/O operations involving numbers.

The numpunct template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from a numpunct facet.

Public typedefs

Numpunct facet id.

Numpunct constructor.

Parameters
__refsRefcount to pass to the base class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up the predefined locale facets.

Parameters
__cache__numpunct_cache object.
__refsRefcount to pass to the base class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__refsRefcount to pass to the base class.

Return decimal point character.

This function returns a char_type to use as a decimal point. It does so by returning returning numpunct<char_type>::do_decimal_point().

Returns
char_type representing a decimal point.

Return thousands separator character.

This function returns a char_type to use as a thousands separator. It does so by returning returning numpunct<char_type>::do_thousands_sep().

Returns
char_type representing a thousands separator.

Return grouping specification.

This function returns a string representing groupings for the integer part of a number. Groupings indicate where thousands separators should be inserted in the integer part of a number.

Each char in the return string is interpret as an integer rather than a character. These numbers represent the number of digits in a group. The first char in the string represents the number of digits in the least significant group. If a char is negative, it indicates an unlimited number of digits for the group. If more chars from the string are required to group a number, the last char is used repeatedly.

For example, if the grouping() returns "\003\002" and is applied to the number 123456789, this corresponds to 12,34,56,789. Note that if the string was "32", this would put more than 50 digits into the least significant group if the character set is ASCII.

The string is returned by calling numpunct<char_type>::do_grouping().

Returns
string representing grouping specification.

Return string representation of bool true.

This function returns a string_type containing the text representation for true bool variables. It does so by calling numpunct<char_type>::do_truename().

Returns
string_type representing printed form of true.

Return string representation of bool false.

This function returns a string_type containing the text representation for false bool variables. It does so by calling numpunct<char_type>::do_falsename().

Returns
string_type representing printed form of false.

Destructor.

Return decimal point character.

Returns a char_type to use as a decimal point. This function is a hook for derived classes to change the value returned.

Returns
char_type representing a decimal point.

Return thousands separator character.

Returns a char_type to use as a thousands separator. This function is a hook for derived classes to change the value returned.

Returns
char_type representing a thousands separator.

Return grouping specification.

Returns a string representing groupings for the integer part of a number. This function is a hook for derived classes to change the value returned.

See also
grouping() for details.
Returns
String representing grouping specification.

Return string representation of bool true.

Returns a string_type containing the text representation for true bool variables. This function is a hook for derived classes to change the value returned.

Returns
string_type representing printed form of true.

Return string representation of bool false.

Returns a string_type containing the text representation for false bool variables. This function is a hook for derived classes to change the value returned.

Returns
string_type representing printed form of false.

class numpunct_byname [22.2.3.2].

Primary class template num_get.

This facet encapsulates the code to parse and return a number from a string. It is used by the istream numeric extraction operators.

The num_get template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the num_get facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Numeric parsing.

Parses the input stream into the bool v. It does so by calling num_get::do_get().

If ios_base::boolalpha is set, attempts to read ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets v to true or false if successful. Sets err to ios_base::failbit if reading the string fails. Sets err to ios_base::eofbit if the stream is emptied.

If ios_base::boolalpha is not set, proceeds as with reading a long, except if the value is 1, sets v to true, if the value is 0, sets v to false, and otherwise set err to ios_base::failbit.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the integral variable v. It does so by calling num_get::do_get().

Parsing is affected by the flag settings in io.

The basic parse is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, parses like the scanf o specifier. Else if equal to ios_base::hex, parses like X specifier. Else if basefield equal to 0, parses like the i specifier. Otherwise, parses like d for signed and u for unsigned types. The matching type length modifier is also used.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the integral variable v. It does so by calling num_get::do_get().

The input characters are parsed like the scanf g specifier. The matching type length modifier is also used.

The decimal point character used is numpunct::decimal_point(). Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the pointer variable v. It does so by calling num_get::do_get().

The input characters are parsed like the scanf p specifier.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

Note that the digit grouping effect for pointers is a bit ambiguous in the standard and shouldn't be relied on. See DR 344.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Destructor.

Numeric parsing.

Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also
get() for more details.
Parameters
__begStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Primary class template num_put.

This facet encapsulates the code to convert a number to a string. It is used by the ostream numeric insertion operators.

The num_put template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the num_put facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Numeric formatting.

Formats the boolean v and inserts it into a stream. It does so by calling num_put::do_put().

If ios_base::boolalpha is set, writes ctype<CharT>::truename() or ctype<CharT>::falsename(). Otherwise formats v as an int.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the integral value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, formats like the printf o specifier. Else if equal to ios_base::hex, formats like x or X with ios_base::uppercase unset or set respectively. Otherwise, formats like d, ld, lld for signed and u, lu, llu for unsigned values. Note that if both oct and hex are set, neither will take effect.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showbase is set, '0' precedes octal values (except 0) and '0[xX]' precedes hex values.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the floating point value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::floatfield. If equal to ios_base::fixed, formats like the printf f specifier. Else if equal to ios_base::scientific, formats like e or E with ios_base::uppercase unset or set respectively. Otherwise, formats like g or G depending on uppercase. Note that if both fixed and scientific are set, the effect will also be like g or G.

The output precision is given by io.precision(). This precision is capped at numeric_limits::digits10 + 2 (different for double and long double). The default precision is 6.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showpoint is set, a decimal point will always be output.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the pointer value v and inserts it into a stream. It does so by calling num_put::do_put().

This function formats v as an unsigned long with ios_base::hex and ios_base::showbase set.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Destructor.

Numeric formatting.

These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Convenience interface to ctype.is(ctype_base::space, __c).

Convenience interface to ctype.is(ctype_base::print, __c).

Convenience interface to ctype.is(ctype_base::cntrl, __c).

Convenience interface to ctype.is(ctype_base::upper, __c).

Convenience interface to ctype.is(ctype_base::lower, __c).

Convenience interface to ctype.is(ctype_base::alpha, __c).

Convenience interface to ctype.is(ctype_base::digit, __c).

Convenience interface to ctype.is(ctype_base::punct, __c).

Convenience interface to ctype.is(ctype_base::xdigit, __c).

Convenience interface to ctype.is(ctype_base::alnum, __c).

Convenience interface to ctype.is(ctype_base::graph, __c).

Convenience interface to ctype.toupper(__c).

Convenience interface to ctype.tolower(__c).

Template class basic_ios, virtual base class for all stream classes.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.

Most of the member functions called dispatched on stream objects (e.g., std::cout.foo(bar);) are consolidated in this class.

These are standard types. They permit a standardized way of referring to names of (or names dependent on) the template parameters, which are specific to the implementation.

These are non-standard types.

The quick-and-easy status check.

This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ...

Returns the error state of the stream buffer.

Returns
A bit pattern (well, isn't everything?)

See std::ios_base::iostate for the possible bit values. Most users will call one of the interpreting wrappers, e.g., good().

[Re]sets the error state.

Parameters
__stateThe new state flag(s) to set.

See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument.

Sets additional flags in the error state.

Parameters
__stateThe additional state flag(s) to set.

See std::ios_base::iostate for the possible bit values.

Fast error checking.

Returns
True if no error flags are set.

A wrapper around rdstate.

Fast error checking.

Returns
True if the eofbit is set.

Note that other iostate flags may also be set.

Fast error checking.

Returns
True if either the badbit or the failbit is set.

Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set.

Fast error checking.

Returns
True if the badbit is set.

Note that other iostate flags may also be set.

Throwing exceptions on errors.

Returns
The current exceptions mask.

This changes nothing in the stream. See the one-argument version of exceptions(iostate) for the meaning of the return value.

Throwing exceptions on errors.

Parameters
__exceptThe new exceptions mask.

By default, error flags are set silently. You can set an exceptions mask for each stream; if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown.

If the error flag is already set when the exceptions mask is added, the exception is immediately thrown. Try running the following under GCC 3.1 or later:

#include <iostream>
#include <fstream>
#include <exception>
int main()
{
std::ifstream f ("/etc/motd");
std::cerr << "Setting badbit\n";
f.setstate (std::ios_base::badbit);
std::cerr << "Setting exception mask\n";
f.exceptions (std::ios_base::badbit);
}

Constructor performs initialization.

The parameter is passed by derived streams.

Empty.

The destructor does nothing. More specifically, it does not destroy the streambuf held by rdbuf().

Fetches the current tied stream.

Returns
A pointer to the tied stream, or NULL if the stream is not tied.

A stream may be tied (or synchronized) to a second output stream. When this stream performs any I/O, the tied stream is first flushed. For example, std::cin is tied to std::cout.

Ties this stream to an output stream.

Parameters
__tiestrThe output stream.
Returns
The previously tied output stream, or NULL if the stream was not tied.

This sets up a new tie; see tie() for more.

Accessing the underlying buffer.

Returns
The current stream buffer.

This does not change the state of the stream.

Changing the underlying buffer.

Parameters
__sbThe new stream buffer.
Returns
The previous stream buffer.

Associates a new buffer with the current stream, and clears the error state.

Due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error: this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. As a result, you must use explicit qualifications to access this function via any derived class. For example:

std::fstream foo; // or some other derived type
std::streambuf* p = .....;
foo.ios::rdbuf(p); // ios == basic_ios<char>

Copies fields of __rhs into this.

Parameters
__rhsThe source values for the copies.
Returns
Reference to this object.

All fields of __rhs are copied into this object except that rdbuf() and rdstate() remain unchanged. All values in the pword and iword arrays are copied. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. The final step is to copy exceptions().

Retrieves the empty character.

Returns
The current fill character.

It defaults to a space (' ') in the current locale.

Sets a new empty character.

Parameters
__chThe new character.
Returns
The previous fill character.

The fill character is used to fill out space when P+ characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. It defaults to a space (' ') in the current locale.

Moves to a new locale.

Parameters
__locThe new locale.
Returns
The previous locale.

Calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, calls that buffer's pubimbue(loc).

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Squeezes characters.

Parameters
__cThe character to narrow.
__dfaultThe character to narrow.
Returns
The narrowed character.

Maps a character of char_type to a character of char, if possible.

Returns the result of

std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Widens characters.

Parameters
__cThe character to widen.
Returns
The widened character.

Maps a character of char to a character of char_type.

Returns the result of

std::use_facet<ctype<char_type> >(getloc()).widen(c)

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Empty.

The default constructor does nothing and is not normally accessible to users.

All setup is performed here.

This is called from the public constructor. It is not virtual and cannot be redefined.

Constructs an object in existing memory by invoking an allocated object's constructor with an initializer.

Destroy the object pointed to by a pointer type.

Destroy a range of objects. If the value_type of the object has a trivial destructor, the compiler should optimize all of this away, otherwise the objects' destructors must be invoked.

Destroy a range of objects using the supplied allocator. For nondefault allocators we do not optimize away invocation of destroy() even if _Tp has a trivial destructor.

Allocates a temporary buffer.

Parameters
__lenThe number of objects of type Tp.
Returns
See full description.

Reinventing the wheel, but this time with prettier spokes!

This function tries to obtain storage for __len adjacent Tp objects. The objects themselves are not constructed, of course. A pair<> is returned containing the buffer s address and capacity (in the units of sizeof(_Tp)), or a pair of 0 values if no storage can be obtained. Note that the capacity obtained may be less than that requested if the memory is unavailable; you should compare len with the .second return value.

Provides the nothrow exception guarantee.

The companion to get_temporary_buffer().

Parameters
__pA buffer previously allocated by get_temporary_buffer.
Returns
None.

Frees the memory pointed to by __p.

This class is used in two places: stl_algo.h and ext/memory, where it is wrapped as the temporary_buffer class. See temporary_buffer docs for more notes.

As per Table mumble.

Returns the size requested by the constructor; may be >size().

As per Table mumble.

As per Table mumble.

Constructs a temporary buffer of a size somewhere between zero and the size of the given range.

Swaps the median value of *__a, *__b and *__c under __comp to *__result

This is an overload used by find algos for the Input Iterator case.

This is an overload used by find algos for the RAI case.

Provided for stable_partition to use.

Like find_if_not(), but uses and updates a count of the remaining range length instead of comparing against an end iterator.

This is an helper function for search_n overloaded for forward iterators.

This is an helper function for search_n overloaded for random access iterators.

Find last matching subsequence in a sequence.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of sequence to match.
__last2End of sequence to match.
Returns
The last iterator i in the range [__first1,__last1-(__last2-__first2)) such that *(i+N) == *(__first2+N) for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2) and returns an iterator to the __first element of the sub-sequence, or __last1 if the sub-sequence is not found. The sub-sequence will be the last such subsequence contained in [__first1,__last1).

Because the sub-sequence must lie completely within the range [__first1,__last1) it must start at a position less than __last1-(__last2-__first2) where __last2-__first2 is the length of the sub-sequence. This means that the returned iterator i will be in the range [__first1,__last1-(__last2-__first2))

Find last matching subsequence in a sequence using a predicate.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of sequence to match.
__last2End of sequence to match.
__compThe predicate to use.
Returns
The last iterator i in the range [__first1,__last1-(__last2-__first2)) such that predicate(*(i+N), (__first2+N)) is true for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2) using comp as a predicate and returns an iterator to the first element of the sub-sequence, or __last1 if the sub-sequence is not found. The sub-sequence will be the last such subsequence contained in [__first,__last1).

Because the sub-sequence must lie completely within the range [__first1,__last1) it must start at a position less than __last1-(__last2-__first2) where __last2-__first2 is the length of the sub-sequence. This means that the returned iterator i will be in the range [__first1,__last1-(__last2-__first2))

Copy a sequence, removing elements of a given value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__valueThe value to be removed.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) not equal to __value to the range beginning at __result. remove_copy() is stable, so the relative order of elements that are copied is unchanged.

Copy a sequence, removing elements for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__predA predicate.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) for which __pred returns false to the range beginning at __result.

remove_copy_if() is stable, so the relative order of elements that are copied is unchanged.

Remove elements from a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__valueThe value to be removed.
Returns
An iterator designating the end of the resulting sequence.

All elements equal to __value are removed from the range [__first,__last).

remove() is stable, so the relative order of elements that are not removed is unchanged.

Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

Remove elements from a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate.
Returns
An iterator designating the end of the resulting sequence.

All elements for which __pred returns true are removed from the range [__first,__last).

remove_if() is stable, so the relative order of elements that are not removed is unchanged.

Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

Remove consecutive duplicate values from a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
An iterator designating the end of the resulting sequence.

Removes all but the first element from each group of consecutive values that compare equal. unique() is stable, so the relative order of elements that are not removed is unchanged. Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

Remove consecutive values from a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__binary_predA binary predicate.
Returns
An iterator designating the end of the resulting sequence.

Removes all but the first element from each group of consecutive values for which __binary_pred returns true. unique() is stable, so the relative order of elements that are not removed is unchanged. Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator, _BinaryPredicate) overloaded for forward iterators and output iterator as result.

This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator, _BinaryPredicate) overloaded for input iterators and output iterator as result.

This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator, _BinaryPredicate) overloaded for input iterators and forward iterator as result.

This is an uglified reverse(_BidirectionalIterator, _BidirectionalIterator) overloaded for bidirectional iterators.

This is an uglified reverse(_BidirectionalIterator, _BidirectionalIterator) overloaded for random access iterators.

Reverse a sequence.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
Returns
reverse() returns no value.

Reverses the order of the elements in the range [__first,__last), so that the first element becomes the last etc. For every i such that 0<=i<=(__last-__first)/2), reverse() swaps *(__first+i) and *(__last-(i+1))

Copy a sequence, reversing its elements.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies the elements in the range [__first,__last) to the range [__result,__result+(__last-__first)) such that the order of the elements is reversed. For every i such that 0<=i<=(__last-__first), reverse_copy() performs the assignment *(__result+(__last-__first)-1-i) = *(__first+i). The ranges [__first,__last) and [__result,__result+(__last-__first)) must not overlap.

This is a helper function for the rotate algorithm specialized on RAIs. It returns the greatest common divisor of two integer values.

This is a helper function for the rotate algorithm.

This is a helper function for the rotate algorithm.

This is a helper function for the rotate algorithm.

Rotate the elements of a sequence.

Parameters
__firstA forward iterator.
__middleA forward iterator.
__lastA forward iterator.
Returns
first + (last - middle).

Rotates the elements of the range [__first,__last) by (__middle - __first) positions so that the element at __middle is moved to __first, the element at __middle+1 is moved to __first+1 and so on for each element in the range [__first,__last).

This effectively swaps the ranges [__first,__middle) and [__middle,__last).

Performs *(__first+(n+(__last-__middle))%(__last-__first))=*(__first+n) for each n in the range [0,__last-__first).

Copy a sequence, rotating its elements.

Parameters
__firstA forward iterator.
__middleA forward iterator.
__lastA forward iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies the elements of the range [__first,__last) to the range beginning at

Returns
, rotating the copied elements by (__middle-__first) positions so that the element at __middle is moved to __result, the element at __middle+1 is moved to __result+1 and so on for each element in the range [__first,__last).

Performs *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n) for each n in the range [0,__last-__first).

This is a helper function...

This is a helper function...

This is a helper function... Requires __first != __last and !__pred(__first) and __len == distance(__first, __last).

!__pred(__first) allows us to guarantee that we don't move-assign an element onto itself.

Move elements for which a predicate is true to the beginning of a sequence, preserving relative ordering.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate functor.
Returns
An iterator middle such that __pred(i) is true for each iterator i in the range [first,middle) and false for each i in the range [middle,last).

Performs the same function as partition() with the additional guarantee that the relative ordering of elements in each group is preserved, so any two elements x and y in the range [__first,__last) such that __pred(x)==__pred(y) will have the same relative ordering after calling stable_partition().

This is a helper function for the sort routines.

Copy the smallest elements of a sequence.

Parameters
__firstAn iterator.
__lastAnother iterator.
__result_firstA random-access iterator.
__result_lastAnother random-access iterator.
Returns
An iterator indicating the end of the resulting sequence.

Copies and sorts the smallest N values from the range [__first,__last) to the range beginning at __result_first, where the number of elements to be copied, N, is the smaller of (__last-__first) and (__result_last-__result_first). After the sort if i and j are iterators in the range [__result_first,__result_first+N) such that i precedes j then *j<*i is false. The value returned is __result_first+N.

Copy the smallest elements of a sequence using a predicate for comparison.

Parameters
__firstAn input iterator.
__lastAnother input iterator.
__result_firstA random-access iterator.
__result_lastAnother random-access iterator.
__compA comparison functor.
Returns
An iterator indicating the end of the resulting sequence.

Copies and sorts the smallest N values from the range [__first,__last) to the range beginning at result_first, where the number of elements to be copied, N, is the smaller of (__last-__first) and (__result_last-__result_first). After the sort if i and j are iterators in the range [__result_first,__result_first+N) such that i precedes j then __comp(*j,*i) is false. The value returned is __result_first+N.

This is a helper function for the sort routine.

This is a helper function for the sort routine.

This is a helper function for the sort routine.

This controls some aspect of the sort routines.

This is a helper function for the sort routine.

This is a helper function...

This is a helper function...

This is a helper function for the sort routine.

Finds the first position in which __val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
An iterator pointing to the first element not less than __val, or end() if every element is less than __val.

The comparison function should have the same effects on ordering as the function used for the initial sort.

Finds the last position in which __val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
An iterator pointing to the first element greater than __val, or end() if no elements are greater than __val.

Finds the last position in which __val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
An iterator pointing to the first element greater than __val, or end() if no elements are greater than __val.

The comparison function should have the same effects on ordering as the function used for the initial sort.

Finds the largest subrange in which __val could be inserted at any place in it without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
An pair of iterators defining the subrange.

This is equivalent to

std::make_pair(lower_bound(__first, __last, __val),
upper_bound(__first, __last, __val))

but does not actually call those functions.

Finds the largest subrange in which __val could be inserted at any place in it without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
An pair of iterators defining the subrange.

This is equivalent to

std::make_pair(lower_bound(__first, __last, __val, __comp),
upper_bound(__first, __last, __val, __comp))

but does not actually call those functions.

Determines whether an element exists in a range.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
True if __val (or its equivalent) is in [__first,__last ].

Note that this does not actually return an iterator to __val. For that, use std::find or a container's specialized find member functions.

Determines whether an element exists in a range.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
True if __val (or its equivalent) is in [__first,__last].

Note that this does not actually return an iterator to __val. For that, use std::find or a container's specialized find member functions.

The comparison function should have the same effects on ordering as the function used for the initial sort.

This is a helper function for the __merge_adaptive routines.

This is a helper function for the __merge_adaptive routines.

This is a helper function for the merge routines.

This is a helper function for the merge routines.

This is a helper function for the merge routines.

Merges two sorted ranges in place.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
Returns
Nothing.

Merges two sorted and consecutive ranges, [__first,__middle) and [__middle,__last), and puts the result in [__first,__last). The output will be sorted. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

If enough additional memory is available, this takes (__last-__first)-1 comparisons. Otherwise an NlogN algorithm is used, where N is distance(__first,__last).

Merges two sorted ranges in place.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
__compA functor to use for comparisons.
Returns
Nothing.

Merges two sorted and consecutive ranges, [__first,__middle) and [middle,last), and puts the result in [__first,__last). The output will be sorted. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

If enough additional memory is available, this takes (__last-__first)-1 comparisons. Otherwise an NlogN algorithm is used, where N is distance(__first,__last).

The comparison function should have the same effects on ordering as the function used for the initial sort.

This is a helper function for the __merge_sort_loop routines.

This is a helper function for the stable sorting routines.

Determines whether all elements of a sequence exists in a range.

Parameters
__first1Start of search range.
__last1End of search range.
__first2Start of sequence
__last2End of sequence.
Returns
True if each element in [__first2,__last2) is contained in order within [__first1,__last1). False otherwise.

This operation expects both [__first1,__last1) and [__first2,__last2) to be sorted. Searches for the presence of each element in [__first2,__last2) within [__first1,__last1). The iterators over each range only move forward, so this is a linear algorithm. If an element in [__first2,__last2) is not found before the search iterator reaches __last2, false is returned.

Determines whether all elements of a sequence exists in a range using comparison.

Parameters
__first1Start of search range.
__last1End of search range.
__first2Start of sequence
__last2End of sequence.
__compComparison function to use.
Returns
True if each element in [__first2,__last2) is contained in order within [__first1,__last1) according to comp. False otherwise.

This operation expects both [__first1,__last1) and [__first2,__last2) to be sorted. Searches for the presence of each element in [__first2,__last2) within [__first1,__last1), using comp to decide. The iterators over each range only move forward, so this is a linear algorithm. If an element in [__first2,__last2) is not found before the search iterator reaches __last2, false is returned.

Permute range into the next dictionary ordering.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
False if wrapped to first permutation, true otherwise.

Treats all permutations of the range as a set of dictionary sorted sequences. Permutes the current sequence into the next one of this set. Returns true if there are more sequences to generate. If the sequence is the largest of the set, the smallest is generated and false returned.

Permute range into the next dictionary ordering using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compA comparison functor.
Returns
False if wrapped to first permutation, true otherwise.

Treats all permutations of the range [__first,__last) as a set of dictionary sorted sequences ordered by __comp. Permutes the current sequence into the next one of this set. Returns true if there are more sequences to generate. If the sequence is the largest of the set, the smallest is generated and false returned.

Permute range into the previous dictionary ordering.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
False if wrapped to last permutation, true otherwise.

Treats all permutations of the range as a set of dictionary sorted sequences. Permutes the current sequence into the previous one of this set. Returns true if there are more sequences to generate. If the sequence is the smallest of the set, the largest is generated and false returned.

Permute range into the previous dictionary ordering using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compA comparison functor.
Returns
False if wrapped to last permutation, true otherwise.

Treats all permutations of the range [__first,__last) as a set of dictionary sorted sequences ordered by __comp. Permutes the current sequence into the previous one of this set. Returns true if there are more sequences to generate. If the sequence is the smallest of the set, the largest is generated and false returned.

Copy a sequence, replacing each element of one value with another value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__old_valueThe value to be replaced.
__new_valueThe replacement value.
Returns
The end of the output sequence, result+(last-first).

Copies each element in the input range [__first,__last) to the output range [__result,__result+(__last-__first)) replacing elements equal to __old_value with __new_value.

Copy a sequence, replacing each value for which a predicate returns true with another value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__predA predicate.
__new_valueThe replacement value.
Returns
The end of the output sequence, __result+(__last-__first).

Copies each element in the range [__first,__last) to the range [__result,__result+(__last-__first)) replacing elements for which __pred returns true with __new_value.

Apply a function to every element of a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__fA unary function object.
Returns
__f (std::move(__f) in C++0x).

Applies the function object __f to each element in the range [first,last). __f must not modify the order of the sequence. If __f has a return value it is ignored.

Find the first occurrence of a value in a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__valThe value to find.
Returns
The first iterator i in the range [__first,__last) such that *i == __val, or __last if no such iterator exists.

Find the first element in a sequence for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__predA predicate.
Returns
The first iterator i in the range [__first,__last) such that __pred(*i) is true, or __last if no such iterator exists.

Find element from a set in a sequence.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of match candidates.
__last2End of match candidates.
Returns
The first iterator i in the range [__first1,__last1) such that *i == *(i2) such that i2 is an iterator in [__first2,__last2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for an element that is equal to some element in the range [__first2,__last2). If found, returns an iterator in the range [__first1,__last1), otherwise returns __last1.

Find element from a set in a sequence using a predicate.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of match candidates.
__last2End of match candidates.
__compPredicate to use.
Returns
The first iterator i in the range [__first1,__last1) such that comp(*i, *(i2)) is true and i2 is an iterator in [__first2,__last2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for an element that is equal to some element in the range [__first2,__last2). If found, returns an iterator in the range [__first1,__last1), otherwise returns __last1.

Find two adjacent values in a sequence that are equal.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
The first iterator i such that i and i+1 are both valid iterators in [__first,__last) and such that *i == *(i+1), or __last if no such iterator exists.

Find two adjacent values in a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__binary_predA binary predicate.
Returns
The first iterator i such that i and i+1 are both valid iterators in [__first,__last) and such that __binary_pred(i,(i+1)) is true, or __last if no such iterator exists.

Count the number of copies of a value in a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__valueThe value to be counted.
Returns
The number of iterators i in the range [__first,__last) for which *i == __value

Count the elements of a sequence for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__predA predicate.
Returns
The number of iterators i in the range [__first,__last) for which __pred(*i) is true.

Search a sequence for a matching sub-sequence.

Parameters
__first1A forward iterator.
__last1A forward iterator.
__first2A forward iterator.
__last2A forward iterator.
Returns
The first iterator i in the range [__first1,__last1-(__last2-__first2)) such that *(i+N) == *(__first2+N) for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2) and returns an iterator to the first element of the sub-sequence, or __last1 if the sub-sequence is not found.

Because the sub-sequence must lie completely within the range [__first1,__last1) it must start at a position less than __last1-(__last2-__first2) where __last2-__first2 is the length of the sub-sequence.

This means that the returned iterator i will be in the range [__first1,__last1-(__last2-__first2))

Search a sequence for a matching sub-sequence using a predicate.

Parameters
__first1A forward iterator.
__last1A forward iterator.
__first2A forward iterator.
__last2A forward iterator.
__predicateA binary predicate.
Returns
The first iterator i in the range [__first1,__last1-(__last2-__first2)) such that __predicate(*(i+N),*(__first2+N)) is true for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2), using __predicate to determine equality, and returns an iterator to the first element of the sub-sequence, or __last1 if no such iterator exists.

See also
search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2)

Search a sequence for a number of consecutive values.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__countThe number of consecutive values.
__valThe value to find.
Returns
The first iterator i in the range [__first,__last-__count) such that *(i+N) == __val for each N in the range [0,__count), or __last if no such iterator exists.

Searches the range [__first,__last) for count consecutive elements equal to __val.

Search a sequence for a number of consecutive values using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__countThe number of consecutive values.
__valThe value to find.
__binary_predA binary predicate.
Returns
The first iterator i in the range [__first,__last-__count) such that __binary_pred(*(i+N),__val) is true for each N in the range [0,__count), or __last if no such iterator exists.

Searches the range [__first,__last) for __count consecutive elements for which the predicate returns true.

Perform an operation on a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__unary_opA unary operator.
Returns
An output iterator equal to __result+(__last-__first).

Applies the operator to each element in the input range and assigns the results to successive elements of the output sequence. Evaluates *(__result+N)=unary_op(*(__first+N)) for each N in the range [0,__last-__first).

unary_op must not alter its argument.

Perform an operation on corresponding elements of two sequences.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__resultAn output iterator.
__binary_opA binary operator.
Returns
An output iterator equal to result+(last-first).

Applies the operator to the corresponding elements in the two input ranges and assigns the results to successive elements of the output sequence. Evaluates *(__result+N)=__binary_op(*(__first1+N),*(__first2+N)) for each N in the range [0,__last1-__first1).

binary_op must not alter either of its arguments.

Replace each occurrence of one value in a sequence with another value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__old_valueThe value to be replaced.
__new_valueThe replacement value.
Returns
replace() returns no value.

For each iterator i in the range [__first,__last) if *i == __old_value then the assignment *i = __new_value is performed.

Replace each value in a sequence for which a predicate returns true with another value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate.
__new_valueThe replacement value.
Returns
replace_if() returns no value.

For each iterator i in the range [__first,__last) if __pred(*i) is true then the assignment *i = __new_value is performed.

Assign the result of a function object to each value in a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__genA function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type
Returns
generate() returns no value.

Performs the assignment *i = __gen() for each i in the range [__first,__last).

Assign the result of a function object to each value in a sequence.

Parameters
__firstA forward iterator.
__nThe length of the sequence.
__genA function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type
Returns
The end of the sequence, __first+__n

Performs the assignment *i = __gen() for each i in the range [__first,__first+__n).

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 865. More algorithms that throw away information

Copy a sequence, removing consecutive duplicate values.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) to the range beginning at __result, except that only the first element is copied from groups of consecutive elements that compare equal. unique_copy() is stable, so the relative order of elements that are copied is unchanged.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 241. Does unique_copy() require CopyConstructible and Assignable?

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 538. 241 again: Does unique_copy() require CopyConstructible and Assignable?

Copy a sequence, removing consecutive values using a predicate.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__binary_predA binary predicate.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) to the range beginning at __result, except that only the first element is copied from groups of consecutive elements for which __binary_pred returns true. unique_copy() is stable, so the relative order of elements that are copied is unchanged.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 241. Does unique_copy() require CopyConstructible and Assignable?

Randomly shuffle the elements of a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
Nothing.

Reorder the elements in the range [__first,__last) using a random distribution, so that every possible ordering of the sequence is equally likely.

Shuffle the elements of a sequence using a random number generator.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__randThe RNG functor or function.
Returns
Nothing.

Reorders the elements in the range [__first,__last) using __rand to provide a random distribution. Calling __rand(N) for a positive integer N should return a randomly chosen integer from the range [0,N).

Move elements for which a predicate is true to the beginning of a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate functor.
Returns
An iterator middle such that __pred(i) is true for each iterator i in the range [__first,middle) and false for each i in the range [middle,__last).

__pred must not modify its operand. partition() does not preserve the relative ordering of elements in each group, use stable_partition() if this is needed.

Sort the smallest elements of a sequence.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
Returns
Nothing.

Sorts the smallest (__middle-__first) elements in the range [first,last) and moves them to the range [__first,__middle). The order of the remaining elements in the range [__middle,__last) is undefined. After the sort if i and j are iterators in the range [__first,__middle) such that i precedes j and k is an iterator in the range [__middle,__last) then *j<*i and *k<*i are both false.

Sort the smallest elements of a sequence using a predicate for comparison.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Sorts the smallest (__middle-__first) elements in the range [__first,__last) and moves them to the range [__first,__middle). The order of the remaining elements in the range [__middle,__last) is undefined. After the sort if i and j are iterators in the range [__first,__middle) such that i precedes j and k is an iterator in the range [__middle,__last) then *__comp(j,*i) and __comp(*k,*i) are both false.

Sort a sequence just enough to find a particular position.

Parameters
__firstAn iterator.
__nthAnother iterator.
__lastAnother iterator.
Returns
Nothing.

Rearranges the elements in the range [__first,__last) so that *__nth is the same element that would have been in that position had the whole sequence been sorted. The elements either side of *__nth are not completely sorted, but for any iterator i in the range [__first,__nth) and any iterator j in the range [__nth,__last) it holds that *j < *i is false.

Sort a sequence just enough to find a particular position using a predicate for comparison.

Parameters
__firstAn iterator.
__nthAnother iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Rearranges the elements in the range [__first,__last) so that *__nth is the same element that would have been in that position had the whole sequence been sorted. The elements either side of *__nth are not completely sorted, but for any iterator i in the range [__first,__nth) and any iterator j in the range [__nth,__last) it holds that __comp(*j,*i) is false.

Sort the elements of a sequence.

Parameters
__firstAn iterator.
__lastAnother iterator.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that for each iterator i in the range [__first,__last-1), *(i+1)<*i is false.

The relative ordering of equivalent elements is not preserved, use stable_sort() if this is needed.

Sort the elements of a sequence using a predicate for comparison.

Parameters
__firstAn iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that __comp(*(i+1),*i) is false for every iterator i in the range [__first,__last-1).

The relative ordering of equivalent elements is not preserved, use stable_sort() if this is needed.

Merges two sorted ranges.

Parameters
__first1An iterator.
__first2Another iterator.
__last1Another iterator.
__last2Another iterator.
__resultAn iterator pointing to the end of the merged range.
Returns
An iterator pointing to the first element not less than val.

Merges the ranges [__first1,__last1) and [__first2,__last2) into the sorted range [__result, __result + (__last1-__first1) + (__last2-__first2)). Both input ranges must be sorted, and the output range must not overlap with either of the input ranges. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

Merges two sorted ranges.

Parameters
__first1An iterator.
__first2Another iterator.
__last1Another iterator.
__last2Another iterator.
__resultAn iterator pointing to the end of the merged range.
__compA functor to use for comparisons.
Returns
An iterator pointing to the first element "not less than" val.

Merges the ranges [__first1,__last1) and [__first2,__last2) into the sorted range [__result, __result + (__last1-__first1) + (__last2-__first2)). Both input ranges must be sorted, and the output range must not overlap with either of the input ranges. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

The comparison function should have the same effects on ordering as the function used for the initial sort.

Sort the elements of a sequence, preserving the relative order of equivalent elements.

Parameters
__firstAn iterator.
__lastAnother iterator.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that for each iterator i in the range [__first,__last-1), *(i+1)<*i is false.

The relative ordering of equivalent elements is preserved, so any two elements x and y in the range [__first,__last) such that x<y is false and y<x is false will have the same relative ordering after calling stable_sort().

Sort the elements of a sequence using a predicate for comparison, preserving the relative order of equivalent elements.

Parameters
__firstAn iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that for each iterator i in the range [__first,__last-1), __comp(*(i+1),*i) is false.

The relative ordering of equivalent elements is preserved, so any two elements x and y in the range [__first,__last) such that __comp(x,y) is false and __comp(y,x) is false will have the same relative ordering after calling stable_sort().

Return the union of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in each range in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that element is copied and the iterator advanced. If an element is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the union of two sorted ranges using a comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in each range in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to __comp, that element is copied and the iterator advanced. If an equivalent element according to __comp is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the intersection of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in both ranges in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that iterator advances. If an element is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the intersection of two sorted ranges using comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in both ranges in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to __comp, that iterator advances. If an element is contained in both ranges according to __comp, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the difference of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in the first range but not the second in order to the output range. Iterators increment for each range. When the current element of the first range is less than the second, that element is copied and the iterator advances. If the current element of the second range is less, the iterator advances, but no element is copied. If an element is contained in both ranges, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the difference of two sorted ranges using comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in the first range but not the second in order to the output range. Iterators increment for each range. When the current element of the first range is less than the second according to __comp, that element is copied and the iterator advances. If the current element of the second range is less, no element is copied and the iterator advances. If an element is contained in both ranges according to __comp, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the symmetric difference of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in one range but not the other in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that element is copied and the iterator advances. If an element is contained in both ranges, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the symmetric difference of two sorted ranges using comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in one range but not the other in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to comp, that element is copied and the iterator advances. If an element is contained in both ranges according to __comp, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the minimum element in a range.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
Iterator referencing the first instance of the smallest value.

Return the minimum element in a range using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compComparison functor.
Returns
Iterator referencing the first instance of the smallest value according to __comp.

Return the maximum element in a range.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
Iterator referencing the first instance of the largest value.

Return the maximum element in a range using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compComparison functor.
Returns
Iterator referencing the first instance of the largest value according to __comp.

Describes the rounding style for floating-point types.

This is used in the std::numeric_limits class.

Intermediate.

To zero.

To the nearest representable value.

To infinity.

To negative infinity.

Describes the denormalization for floating-point types.

These values represent the presence or absence of a variable number of exponent bits. This type is used in the std::numeric_limits class.

Indeterminate at compile time whether denormalized values are allowed.

The type does not allow denormalized values.

The type allows denormalized values.

Part of std::numeric_limits.

The static const members are usable as integral constant expressions.

Note
This is a separate class for purposes of efficiency; you should only access these members as part of an instantiation of the std::numeric_limits class.

This will be true for all fundamental types (which have specializations), and false for everything else.

The number of radix digits that be represented without change: for integer types, the number of non-sign bits in the mantissa; for floating types, the number of radix digits in the mantissa.

The number of base 10 digits that can be represented without change.

True if the type is signed.

True if the type is integer.

True if the type uses an exact representation. All integer types are exact, but not all exact types are integer. For example, rational and fixed-exponent representations are exact but not integer.

For integer types, specifies the base of the representation. For floating types, specifies the base of the exponent representation.

The minimum negative integer such that radix raised to the power of (one less than that integer) is a normalized floating point number.

The minimum negative integer such that 10 raised to that power is in the range of normalized floating point numbers.

The maximum positive integer such that radix raised to the power of (one less than that integer) is a representable finite floating point number.

The maximum positive integer such that 10 raised to that power is in the range of representable finite floating point numbers.

True if the type has a representation for positive infinity.

True if the type has a representation for a quiet (non-signaling) Not a Number.

True if the type has a representation for a signaling Not a Number.

See std::float_denorm_style for more information.

True if loss of accuracy is detected as a denormalization loss, rather than as an inexact result.

True if-and-only-if the type adheres to the IEC 559 standard, also known as IEEE 754. (Only makes sense for floating point types.)

True if the set of values representable by the type is finite. All built-in types are bounded, this member would be false for arbitrary precision types.

True if the type is modulo. A type is modulo if, for any operation involving +, -, or * on values of that type whose result would fall outside the range [min(),max()], the value returned differs from the true value by an integer multiple of max() - min() + 1. On most machines, this is false for floating types, true for unsigned integers, and true for signed integers. See PR22200 about signed integers.

True if trapping is implemented for this type.

True if tininess is detected before rounding. (see IEC 559)

See std::float_round_style for more information. This is only meaningful for floating types; integer types will all be round_toward_zero.

Properties of fundamental types.

This class allows a program to obtain information about the representation of a fundamental type on a given platform. For non-fundamental types, the functions will return 0 and the data members will all be false.

_GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are noted, but not incorporated in this documented (yet).

The minimum finite value, or for floating types with denormalization, the minimum positive normalized value.

The maximum finite value.

The machine epsilon: the difference between 1 and the least value greater than 1 that is representable.

The maximum rounding error measurement (see LIA-1).

The representation of positive infinity, if has_infinity.

The representation of a quiet Not a Number, if has_quiet_NaN.

The representation of a signaling Not a Number, if has_signaling_NaN.

The minimum positive denormalized value. For types where has_denorm is false, this is the minimum positive normalized value.

numeric_limits<bool> specialization.

numeric_limits<char> specialization.

numeric_limits<signed char> specialization.

numeric_limits<unsigned char> specialization.

numeric_limits<wchar_t> specialization.

numeric_limits<short> specialization.

numeric_limits<unsigned short> specialization.

numeric_limits<int> specialization.

numeric_limits<unsigned int> specialization.

numeric_limits<long> specialization.

numeric_limits<unsigned long> specialization.

numeric_limits<long long> specialization.

numeric_limits<unsigned long long> specialization.

numeric_limits<float> specialization.

numeric_limits<double> specialization.

numeric_limits<long double> specialization.

Copies the range [first,last) into result.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
__result + (__first - __last)

Like copy(), but does not require an initialized output range.

Copies the value x into the range [first,last).

Parameters
__firstAn input iterator.
__lastAn input iterator.
__xThe source value.
Returns
Nothing.

Like fill(), but does not require an initialized output range.

Copies the value x into the range [first,first+n).

Parameters
__firstAn input iterator.
__nThe number of copies to make.
__xThe source value.
Returns
Nothing.

Like fill_n(), but does not require an initialized output range.

This iterator class lets algorithms store their results into uninitialized memory.

A wrapper class to provide auto_ptr with reference semantics. For example, an auto_ptr can be assigned (or constructed from) the result of a function which returns an auto_ptr by value.

All the auto_ptr_ref stuff should happen behind the scenes.

A simple smart pointer providing strict ownership semantics.

The Standard says:

An auto_ptr owns the object it holds a pointer to.  Copying
an auto_ptr copies the pointer and transfers ownership to the
destination.  If more than one auto_ptr owns the same object
at the same time the behavior of the program is undefined.
The uses of auto_ptr include providing temporary
exception-safety for dynamically allocated memory, passing
ownership of dynamically allocated memory to a function, and
returning dynamically allocated memory from a function.  auto_ptr does not meet the CopyConstructible and Assignable
requirements for Standard Library container elements and thus
instantiating a Standard Library container with an auto_ptr results in undefined behavior.

Quoted from [20.4.5]/3.

Good examples of what can and cannot be done with auto_ptr can be found in the libstdc++ testsuite.

_GLIBCXX_RESOLVE_LIB_DEFECTS

  1. auto_ptr<> conversion issues These resolutions have all been incorporated.

The pointed-to type.

An auto_ptr is usually constructed from a raw pointer.

Parameters
__pA pointer (defaults to NULL).

This object now owns the object pointed to by __p.

An auto_ptr can be constructed from another auto_ptr.

Parameters
__aAnother auto_ptr of the same type.

This object now owns the object previously owned by __a, which has given up ownership.

An auto_ptr can be constructed from another auto_ptr.

Parameters
__aAnother auto_ptr of a different but related type.

A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.

This object now owns the object previously owned by __a, which has given up ownership.

auto_ptr assignment operator.

Parameters
__aAnother auto_ptr of the same type.

This object now owns the object previously owned by __a, which has given up ownership. The object that this one used to own and track has been deleted.

auto_ptr assignment operator.

Parameters
__aAnother auto_ptr of a different but related type.

A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.

This object now owns the object previously owned by __a, which has given up ownership. The object that this one used to own and track has been deleted.

When the auto_ptr goes out of scope, the object it owns is deleted. If it no longer owns anything (i.e., get() is NULL), then this has no effect.

The C++ standard says there is supposed to be an empty throw specification here, but omitting it is standard conforming. Its presence can be detected only if _Tp::~_Tp() throws, but this is prohibited. [17.4.3.6]/2

Smart pointer dereferencing.

If this auto_ptr no longer owns anything, then this operation will crash. (For a smart pointer, no longer owns anything is the same as being a null pointer, and you know what happens when you dereference one of those...)

Smart pointer dereferencing.

This returns the pointer itself, which the language then will automatically cause to be dereferenced.

Bypassing the smart pointer.

Returns
The raw pointer being managed.

You can get a copy of the pointer that this object owns, for situations such as passing to a function which only accepts a raw pointer.

Note
This auto_ptr still owns the memory.

Bypassing the smart pointer.

Returns
The raw pointer being managed.

You can get a copy of the pointer that this object owns, for situations such as passing to a function which only accepts a raw pointer.

Note
This auto_ptr no longer owns the memory. When this object goes out of scope, nothing will happen.

Forcibly deletes the managed object.

Parameters
__pA pointer (defaults to NULL).

This object now owns the object pointed to by __p. The previous object has been deleted.

Automatic conversions

These operations convert an auto_ptr into and from an auto_ptr_ref automatically as needed. This allows constructs such as

auto_ptr<Derived> func_returning_auto_ptr(.....);
...
auto_ptr<Base> ptr = func_returning_auto_ptr(.....);

The actual work of input and output (for std::string).

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class associates either or both of its input and output sequences with a sequence of characters, which can be initialized from, or made available as, a std::basic_string. (Paraphrased from [27.7.1]/1.)

For this class, open modes (of type ios_base::openmode) have in set if the input sequence can be read, and out set if the output sequence can be written.

Place to stash in || out || in | out settings for current stringbuf.

Starts with an empty string buffer.

Parameters
__modeWhether the buffer can read, or write, or both.

The default constructor initializes the parent class using its own default ctor.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__modeWhether the buffer can read, or write, or both.

This constructor initializes the parent class using its own default ctor.

Copying out the string buffer.

Returns
A copy of one of the underlying sequences.

If the buffer is only created in input mode, the underlying character sequence is equal to the input sequence; otherwise, it is equal to the output sequence. [27.7.1.2]/1

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Deallocates any previous stored sequence, then copies s to use as a new one.

Manipulates the buffer.

Parameters
__sPointer to a buffer area.
__nSize of __s.
Returns
this

If no buffer has already been created, and both __s and __n are non-zero, then __s is used as a buffer; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering for more.

Controlling input for std::string.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class supports reading from objects of type std::basic_string, using the inherited functions from std::basic_istream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.

Default constructor starts with an empty string buffer.

Parameters
__modeWhether the buffer can read, or write, or both.

ios_base::in is automatically included in __mode.

Initializes sb using __mode|in, and passes &sb to the base class initializer. Does not allocate any buffer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__modeWhether the buffer can read, or write, or both.

ios_base::in is automatically included in mode.

Initializes sb using str and mode|in, and passes &sb to the base class initializer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

The destructor does nothing.

The buffer is deallocated by the stringbuf object, not the formatting stream.

Accessing the underlying buffer.

Returns
The current basic_stringbuf buffer.

This hides both signatures of std::basic_ios::rdbuf().

Copying out the string buffer.

Returns
rdbuf()->str()

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Calls rdbuf()->str(s).

Controlling output for std::string.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class supports writing to objects of type std::basic_string, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.

Default constructor starts with an empty string buffer.

Parameters
__modeWhether the buffer can read, or write, or both.

ios_base::out is automatically included in mode.

Initializes sb using mode|out, and passes &sb to the base class initializer. Does not allocate any buffer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__modeWhether the buffer can read, or write, or both.

ios_base::out is automatically included in mode.

Initializes sb using str and mode|out, and passes &sb to the base class initializer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

The destructor does nothing.

The buffer is deallocated by the stringbuf object, not the formatting stream.

Accessing the underlying buffer.

Returns
The current basic_stringbuf buffer.

This hides both signatures of std::basic_ios::rdbuf().

Copying out the string buffer.

Returns
rdbuf()->str()

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Calls rdbuf()->str(s).

Controlling input and output for std::string.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class supports reading from and writing to objects of type std::basic_string, using the inherited functions from std::basic_iostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.

Default constructor starts with an empty string buffer.

Parameters
__mWhether the buffer can read, or write, or both.

Initializes sb using the mode from __m, and passes &sb to the base class initializer. Does not allocate any buffer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__mWhether the buffer can read, or write, or both.

Initializes sb using __str and __m, and passes &sb to the base class initializer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

The destructor does nothing.

The buffer is deallocated by the stringbuf object, not the formatting stream.

Accessing the underlying buffer.

Returns
The current basic_stringbuf buffer.

This hides both signatures of std::basic_ios::rdbuf().

Copying out the string buffer.

Returns
rdbuf()->str()

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Calls rdbuf()->str(s).

See bits/stl_deque.h's _Deque_base for an explanation.

A standard container which offers fixed time access to individual elements in any order.

Template Parameters
_TpType of element.
_AllocAllocator type, defaults to allocator<_Tp>.

Meets the requirements of a container, a reversible container, and a sequence, including the optional sequence requirements with the exception of push_front and pop_front.

In some terminology a vector can be described as a dynamic C-style array, it offers fast and efficient access to individual elements in any order and saves the user from worrying about memory and size allocation. Subscripting ( [] ) access is also provided as with C-style arrays.

Creates a vector with no elements.

Creates a vector with no elements.

Parameters
__aAn allocator object.

Creates a vector with copies of an exemplar element.

Parameters
__nThe number of elements to initially create.
__valueAn element to copy.
__aAn allocator.

This constructor fills the vector with __n copies of __value.

Vector copy constructor.

Parameters
__xA vector of identical element and allocator types.

The newly-created vector uses a copy of the allocation object used by __x. All the elements of __x are copied, but any extra memory in __x (for fast expansion) will not be copied.

Builds a vector from a range.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__aAn allocator.

Create a vector consisting of copies of the elements from [first,last).

If the iterators are forward, bidirectional, or random-access, then this will call the elements' copy constructor N times (where N is distance(first,last)) and do no memory reallocation. But if only input iterators are used, then this will do at most 2N calls to the copy constructor, and logN memory reallocations.

The dtor only erases the elements, and note that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Vector assignment operator.

Parameters
__xA vector of identical element and allocator types.

All the elements of __x are copied, but any extra memory in __x (for fast expansion) will not be copied. Unlike the copy constructor, the allocator object is not copied.

Assigns a given value to a vector.

Parameters
__nNumber of elements to be assigned.
__valValue to be assigned.

This function fills a vector with __n copies of the given value. Note that the assignment completely changes the vector and that the resulting vector's size is the same as the number of elements assigned. Old data may be lost.

Assigns a range to a vector.

Parameters
__firstAn input iterator.
__lastAn input iterator.

This function fills a vector with copies of the elements in the range [__first,__last).

Note that the assignment completely changes the vector and that the resulting vector's size is the same as the number of elements assigned. Old data may be lost.

Get a copy of the memory allocation object.

Returns a read/write iterator that points to the first element in the vector. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points to the first element in the vector. Iteration is done in ordinary element order.

Returns a read/write iterator that points one past the last element in the vector. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points one past the last element in the vector. Iteration is done in ordinary element order.

Returns a read/write reverse iterator that points to the last element in the vector. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to the last element in the vector. Iteration is done in reverse element order.

Returns a read/write reverse iterator that points to one before the first element in the vector. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to one before the first element in the vector. Iteration is done in reverse element order.

Returns the number of elements in the vector.

Returns the size() of the largest possible vector.

Resizes the vector to the specified number of elements.

Parameters
__new_sizeNumber of elements the vector should contain.
__xData with which new elements should be populated.

This function will resize the vector to the specified number of elements. If the number is smaller than the vector's current size the vector is truncated, otherwise the vector is extended and new elements are populated with given data.

Returns the total number of elements that the vector can hold before needing to allocate more memory.

Returns true if the vector is empty. (Thus begin() would equal end().)

Attempt to preallocate enough memory for specified number of elements.

Parameters
__nNumber of elements required.
Exceptions
std::length_errorIf n exceeds max_size().

This function attempts to reserve enough memory for the vector to hold the specified number of elements. If the number requested is more than max_size(), length_error is thrown.

The advantage of this function is that if optimal code is a necessity and the user can determine the number of elements that will be required, the user can reserve the memory in advance, and thus prevent a possible reallocation of memory and copying of vector data.

Subscript access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read/write reference to data.

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)

Subscript access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)

Safety check used only from at().

Provides access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read/write reference to data.
Exceptions
std::out_of_rangeIf __n is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the vector. The function throws out_of_range if the check fails.

Provides access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
Exceptions
std::out_of_rangeIf __n is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the vector. The function throws out_of_range if the check fails.

Returns a read/write reference to the data at the first element of the vector.

Returns a read-only (constant) reference to the data at the first element of the vector.

Returns a read/write reference to the data at the last element of the vector.

Returns a read-only (constant) reference to the data at the last element of the vector.

Returns a pointer such that [data(), data() + size()) is a valid range. For a non-empty vector, data() == &front().

Add data to the end of the vector.

Parameters
__xData to be added.

This is a typical stack operation. The function creates an element at the end of the vector and assigns the given data to it. Due to the nature of a vector this operation can be done in constant time if the vector has preallocated space available.

Removes last element.

This is a typical stack operation. It shrinks the vector by one.

Note that no data is returned, and if the last element's data is needed, it should be retrieved before pop_back() is called.

Inserts given value into vector before specified iterator.

Parameters
__positionAn iterator into the vector.
__xData to be inserted.
Returns
An iterator that points to the inserted data.

This function will insert a copy of the given value before the specified location. Note that this kind of operation could be expensive for a vector and if it is frequently used the user should consider using std::list.

Inserts a number of copies of given data into the vector.

Parameters
__positionAn iterator into the vector.
__nNumber of elements to be inserted.
__xData to be inserted.

This function will insert a specified number of copies of the given data before the location specified by position.

Note that this kind of operation could be expensive for a vector and if it is frequently used the user should consider using std::list.

Inserts a range into the vector.

Parameters
__positionAn iterator into the vector.
__firstAn input iterator.
__lastAn input iterator.

This function will insert copies of the data in the range [__first,__last) into the vector before the location specified by pos.

Note that this kind of operation could be expensive for a vector and if it is frequently used the user should consider using std::list.

Remove element at given position.

Parameters
__positionIterator pointing to element to be erased.
Returns
An iterator pointing to the next element (or end()).

This function will erase the element at the given position and thus shorten the vector by one.

Note This operation could be expensive and if it is frequently used the user should consider using std::list. The user is also cautioned that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove a range of elements.

Parameters
__firstIterator pointing to the first element to be erased.
__lastIterator pointing to one past the last element to be erased.
Returns
An iterator pointing to the element pointed to by __last prior to erasing (or end()).

This function will erase the elements in the range [__first,__last) and shorten the vector accordingly.

Note This operation could be expensive and if it is frequently used the user should consider using std::list. The user is also cautioned that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Swaps data with another vector.

Parameters
__xA vector of the same element and allocator types.

This exchanges the elements between two vectors in constant time. (Three pointers, so it should be quite fast.) Note that the global std::swap() function is specialized such that std::swap(v1,v2) will feed to this function.

Erases all the elements. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Memory expansion handler. Uses the member allocation function to obtain n bytes of memory, and then copies [first,last) into it.

Vector equality comparison.

Parameters
__xA vector.
__yA vector of the same type as __x.
Returns
True iff the size and elements of the vectors are equal.

This is an equivalence relation. It is linear in the size of the vectors. Vectors are considered equivalent if their sizes are equal, and if corresponding elements compare equal.

Vector ordering relation.

Parameters
__xA vector.
__yA vector of the same type as __x.
Returns
True iff __x is lexicographically less than __y.

This is a total ordering relation. It is linear in the size of the vectors. The elements must be comparable with <.

See std::lexicographical_compare() for how the determination is made.

Based on operator==

Based on operator<

Based on operator<

Based on operator<

See std::vector::swap().

A specialization of vector for booleans which offers fixed time access to individual elements in any order.

Template Parameters
_AllocAllocator type.

Note that vector<bool> does not actually meet the requirements for being a container. This is because the reference and pointer types are not really references and pointers to bool. See DR96 for details.

See also
vector for function documentation.

In some terminology a vector can be described as a dynamic C-style array, it offers fast and efficient access to individual elements in any order and saves the user from worrying about memory and size allocation. Subscripting ( [] ) access is also provided as with C-style arrays.

Common part of a node in the list.

An actual node in the list.

A list::iterator.

All the functions are op overloads.

A list::const_iterator.

All the functions are op overloads.

See bits/stl_deque.h's _Deque_base for an explanation.

A standard container with linear time access to elements, and fixed time insertion/deletion at any point in the sequence.

Template Parameters
_TpType of element.
_AllocAllocator type, defaults to allocator<_Tp>.

Meets the requirements of a container, a reversible container, and a sequence, including the optional sequence requirements with the exception of at and operator[].

This is a doubly linked list. Traversal up and down the list requires linear time, but adding and removing elements (or nodes) is done in constant time, regardless of where the change takes place. Unlike std::vector and std::deque, random-access iterators are not provided, so subscripting ( [] ) access is not allowed. For algorithms which only need sequential access, this lack makes no difference.

Also unlike the other standard containers, std::list provides specialized algorithms unique to linked lists, such as splicing, sorting, and in-place reversal.

A couple points on memory allocation for list<Tp>:

First, we never actually allocate a Tp, we allocate List_node<Tp>'s and trust [20.1.5]/4 to DTRT. This is to ensure that after elements from list<X,Alloc1> are spliced into list<X,Alloc2>, destroying the memory of the second list is a valid operation, i.e., Alloc1 giveth and Alloc2 taketh away.

Second, a list conceptually represented as

A <---> B <---> C <---> D

is actually circular; a link exists between A and D. The list class holds (as its only data member) a private list::iterator pointing to D, not to A! To get to the head of the list, we start at the tail and move forward by one. When this member iterator's next/previous pointers refer to itself, the list is empty.

Parameters
__argsAn instance of user data.

Allocates space for a new node and constructs a copy of __args in it.

Creates a list with no elements.

Creates a list with no elements.

Parameters
__aAn allocator object.

Creates a list with copies of an exemplar element.

Parameters
__nThe number of elements to initially create.
__valueAn element to copy.
__aAn allocator object.

This constructor fills the list with __n copies of __value.

List copy constructor.

Parameters
__xA list of identical element and allocator types.

The newly-created list uses a copy of the allocation object used by __x.

Builds a list from a range.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__aAn allocator object.

Create a list consisting of copies of the elements from [__first,__last). This is linear in N (where N is distance(__first,__last)).

No explicit dtor needed as the _Base dtor takes care of things. The _Base dtor only erases the elements, and note that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

List assignment operator.

Parameters
__xA list of identical element and allocator types.

All the elements of __x are copied, but unlike the copy constructor, the allocator object is not copied.

Assigns a given value to a list.

Parameters
__nNumber of elements to be assigned.
__valValue to be assigned.

This function fills a list with __n copies of the given value. Note that the assignment completely changes the list and that the resulting list's size is the same as the number of elements assigned. Old data may be lost.

Assigns a range to a list.

Parameters
__firstAn input iterator.
__lastAn input iterator.

This function fills a list with copies of the elements in the range [__first,__last).

Note that the assignment completely changes the list and that the resulting list's size is the same as the number of elements assigned. Old data may be lost.

Get a copy of the memory allocation object.

Returns a read/write iterator that points to the first element in the list. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points to the first element in the list. Iteration is done in ordinary element order.

Returns a read/write iterator that points one past the last element in the list. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points one past the last element in the list. Iteration is done in ordinary element order.

Returns a read/write reverse iterator that points to the last element in the list. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to the last element in the list. Iteration is done in reverse element order.

Returns a read/write reverse iterator that points to one before the first element in the list. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to one before the first element in the list. Iteration is done in reverse element order.

Returns true if the list is empty. (Thus begin() would equal end().)

Returns the number of elements in the list.

Returns the size() of the largest possible list.

Resizes the list to the specified number of elements.

Parameters
__new_sizeNumber of elements the list should contain.
__xData with which new elements should be populated.

This function will resize the list to the specified number of elements. If the number is smaller than the list's current size the list is truncated, otherwise the list is extended and new elements are populated with given data.

Returns a read/write reference to the data at the first element of the list.

Returns a read-only (constant) reference to the data at the first element of the list.

Returns a read/write reference to the data at the last element of the list.

Returns a read-only (constant) reference to the data at the last element of the list.

Add data to the front of the list.

Parameters
__xData to be added.

This is a typical stack operation. The function creates an element at the front of the list and assigns the given data to it. Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references.

Removes first element.

This is a typical stack operation. It shrinks the list by one. Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed.

Note that no data is returned, and if the first element's data is needed, it should be retrieved before pop_front() is called.

Add data to the end of the list.

Parameters
__xData to be added.

This is a typical stack operation. The function creates an element at the end of the list and assigns the given data to it. Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references.

Removes last element.

This is a typical stack operation. It shrinks the list by one. Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed.

Note that no data is returned, and if the last element's data is needed, it should be retrieved before pop_back() is called.

Inserts given value into list before specified iterator.

Parameters
__positionAn iterator into the list.
__xData to be inserted.
Returns
An iterator that points to the inserted data.

This function will insert a copy of the given value before the specified location. Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references.

Inserts a number of copies of given data into the list.

Parameters
__positionAn iterator into the list.
__nNumber of elements to be inserted.
__xData to be inserted.

This function will insert a specified number of copies of the given data before the location specified by position.

This operation is linear in the number of elements inserted and does not invalidate iterators and references.

Inserts a range into the list.

Parameters
__positionAn iterator into the list.
__firstAn input iterator.
__lastAn input iterator.

This function will insert copies of the data in the range [first,last) into the list before the location specified by position.

This operation is linear in the number of elements inserted and does not invalidate iterators and references.

Remove element at given position.

Parameters
__positionIterator pointing to element to be erased.
Returns
An iterator pointing to the next element (or end()).

This function will erase the element at the given position and thus shorten the list by one.

Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed. The user is also cautioned that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove a range of elements.

Parameters
__firstIterator pointing to the first element to be erased.
__lastIterator pointing to one past the last element to be erased.
Returns
An iterator pointing to the element pointed to by last prior to erasing (or end()).

This function will erase the elements in the range [first,last) and shorten the list accordingly.

This operation is linear time in the size of the range and only invalidates iterators/references to the element being removed. The user is also cautioned that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Swaps data with another list.

Parameters
__xA list of the same element and allocator types.

This exchanges the elements between two lists in constant time. Note that the global std::swap() function is specialized such that std::swap(l1,l2) will feed to this function.

Erases all the elements. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Insert contents of another list.

Parameters
__positionIterator referencing the element to insert before.
__xSource list.

The elements of __x are inserted in constant time in front of the element referenced by __position. __x becomes an empty list.

Requires this != __x.

Insert element from another list.

Parameters
__positionIterator referencing the element to insert before.
__xSource list.
__iIterator referencing the element to move.

Removes the element in list __x referenced by __i and inserts it into the current list before __position.

Insert range from another list.

Parameters
__positionIterator referencing the element to insert before.
__xSource list.
__firstIterator referencing the start of range in x.
__lastIterator referencing the end of range in x.

Removes elements in the range [__first,__last) and inserts them before __position in constant time.

Undefined if __position is in [__first,__last).

Remove all elements equal to value.

Parameters
__valueThe value to remove.

Removes every element in the list equal to value. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove all elements satisfying a predicate.

Template Parameters
_PredicateUnary predicate function or object.

Removes every element in the list for which the predicate returns true. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove consecutive duplicate elements.

For each consecutive set of elements with the same value, remove all but the first one. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove consecutive elements satisfying a predicate.

Template Parameters
_BinaryPredicateBinary predicate function or object.

For each consecutive set of elements [first,last) that satisfy predicate(first,i) where i is an iterator in [first,last), remove all but the first one. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Merge sorted lists.

Parameters
__xSorted list to merge.

Assumes that both __x and this list are sorted according to operator<(). Merges elements of __x into this list in sorted order, leaving __x empty when complete. Elements in this list precede elements in __x that are equal.

Merge sorted lists according to comparison function.

Template Parameters
_StrictWeakOrderingComparison function defining sort order.
Parameters
__xSorted list to merge.
__compComparison functor.

Assumes that both __x and this list are sorted according to StrictWeakOrdering. Merges elements of __x into this list in sorted order, leaving __x empty when complete. Elements in this list precede elements in __x that are equivalent according to StrictWeakOrdering().

Reverse the elements in list.

Reverse the order of elements in the list in linear time.

Sort the elements.

Sorts the elements of this list in NlogN time. Equivalent elements remain in list order.

Sort the elements according to comparison function.

Sorts the elements of this list in NlogN time. Equivalent elements remain in list order.

List equality comparison.

Parameters
__xA list.
__yA list of the same type as __x.
Returns
True iff the size and elements of the lists are equal.

This is an equivalence relation. It is linear in the size of the lists. Lists are considered equivalent if their sizes are equal, and if corresponding elements compare equal.

List ordering relation.

Parameters
__xA list.
__yA list of the same type as __x.
Returns
True iff __x is lexicographically less than __y.

This is a total ordering relation. It is linear in the size of the lists. The elements must be comparable with <.

See std::lexicographical_compare() for how the determination is made.

Based on operator==

Based on operator<

Based on operator<

Based on operator<

See std::list::swap().

Same as C++11 std::addressof

A generalization of pointer arithmetic.

Parameters
__firstAn input iterator.
__lastAn input iterator.
Returns
The distance between them.

Returns n such that __first + n == __last. This requires that __last must be reachable from __first. Note that n may be negative.

For random access iterators, this uses their + and - operations and are constant time. For other iterator classes they are linear time.

A generalization of pointer arithmetic.

Parameters
__iAn input iterator.
__nThe delta by which to change __i.
Returns
Nothing.

This increments i by n. For bidirectional and random access iterators, __n may be negative, in which case __i is decremented.

For random access iterators, this uses their + and - operations and are constant time. For other iterator classes they are linear time.

Swaps the contents of two iterators.

Parameters
__aAn iterator.
__bAnother iterator.
Returns
Nothing.

This function swaps the values pointed to by two iterators, not the iterators themselves.

Swap the elements of two sequences.

Parameters
__first1A forward iterator.
__last1A forward iterator.
__first2A forward iterator.
Returns
An iterator equal to first2+(last1-first1).

Swaps each element in the range [first1,last1) with the corresponding element in the range [first2,(last1-first1)). The ranges must not overlap.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
Returns
The lesser of the parameters.

This is the simple classic generic implementation. It will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
Returns
The greater of the parameters.

This is the simple classic generic implementation. It will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
__compA comparison functor.
Returns
The lesser of the parameters.

This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

This does what you think it does.

Parameters
__aA thing of arbitrary type.
__bAnother thing of arbitrary type.
__compA comparison functor.
Returns
The greater of the parameters.

This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

Copies the range [first,last) into result.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
result + (first - last)

This inline function will boil down to a call to memmove whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling). Result may not be contained within [first,last); the copy_backward function should be used instead.

Note that the end of the output range is permitted to be contained within [first,last).

Copies the range [first,last) into result.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
__resultA bidirectional iterator.
Returns
result - (first - last)

The function has the same effect as copy, but starts at the end of the range and works its way to the start, returning the start of the result. This inline function will boil down to a call to memmove whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling).

Result may not be in the range (first,last]. Use copy instead. Note that the start of the output range may overlap [first,last).

Fills the range [first,last) with copies of value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__valueA reference-to-const of arbitrary type.
Returns
Nothing.

This function fills a range with copies of the same value. For char types filling contiguous areas of memory, this becomes an inline call to memset or wmemset.

Fills the range [first,first+n) with copies of value.

Parameters
__firstAn output iterator.
__nThe count of copies to perform.
__valueA reference-to-const of arbitrary type.
Returns
The iterator at first+n.

This function fills a range with copies of the same value. For char types filling contiguous areas of memory, this becomes an inline call to memset or @ wmemset.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 865. More algorithms that throw away information

Finds the first position in which val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
An iterator pointing to the first element not less than val, or end() if every element is less than val.

This is a helper function for the sort routines and for random.tcc.

Tests a range for element-wise equality.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
Returns
A boolean true or false.

This compares the elements of two ranges using == and returns true or false depending on whether all of the corresponding elements of the ranges are equal.

Tests a range for element-wise equality.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__binary_predA binary predicate functor.
Returns
A boolean true or false.

This compares the elements of two ranges using the binary_pred parameter, and returns true or false depending on whether all of the corresponding elements of the ranges are equal.

Performs dictionary comparison on ranges.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__last2An input iterator.
Returns
A boolean true or false.

Returns true if the sequence of elements defined by the range [first1,last1) is lexicographically less than the sequence of elements defined by the range [first2,last2). Returns false otherwise. (Quoted from [25.3.8]/1.) If the iterators are all character pointers, then this is an inline call to memcmp.

Performs dictionary comparison on ranges.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__last2An input iterator.
__compA comparison functor.
Returns
A boolean true or false.

The same as the four-parameter lexicographical_compare, but uses the comp parameter instead of <.

Finds the places in ranges which don't match.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
Returns
A pair of iterators pointing to the first mismatch.

This compares the elements of two ranges using == and returns a pair of iterators. The first iterator points into the first range, the second iterator points into the second range, and the elements pointed to by the iterators are not equal.

Finds the places in ranges which don't match.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__binary_predA binary predicate functor.
Returns
A pair of iterators pointing to the first mismatch.

This compares the elements of two ranges using the binary_pred parameter, and returns a pair of iterators. The first iterator points into the first range, the second iterator points into the second range, and the elements pointed to by the iterators are not equal.

Mapping from character type to associated types.

Note
This is an implementation class for the generic version of char_traits. It defines int_type, off_type, pos_type, and state_type. By default these are unsigned long, streamoff, streampos, and mbstate_t. Users who need a different set of types, but who don't need to change the definitions of any function defined in char_traits, can specialize __gnu_cxx::_Char_types while leaving __gnu_cxx::char_traits alone.

Base class used to implement std::char_traits.

Note
For any given actual character type, this definition is probably wrong. (Most of the member functions are likely to be right, but the int_type and state_type typedefs, and the eof() member function, are likely to be wrong.) The reason this class exists is so users can specialize it. Classes in namespace std may not be specialized for fundamental types, but classes in namespace __gnu_cxx may be.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types for advice on how to make use of this class for unusual character types. Also, check out include/ext/pod_char_traits.h.

An allocator that uses global new, as per [20.4].

This is precisely the allocator defined in the C++ Standard.

  • all allocation calls operator new
  • all deallocation calls operator delete
Template Parameters
_TpType of allocated object.

Uniform interface to C++98 and C++11 allocators.

Container class for localization functionality.

The locale class is first a class wrapper for C library locales. It is also an extensible container for user-defined localization. A locale is a collection of facets that implement various localization features such as money, time, and number printing.

Constructing C++ locales does not change the C library locale.

This library supports efficient construction and copying of locales through a reference counting implementation of the locale class.

Definition of locale::category.

Category values.

The standard category values are none, ctype, numeric, collate, time, monetary, and messages. They form a bitmask that supports union and intersection. The category all is the union of these values.

NB: Order must match _S_facet_categories definition in locale.cc

Default constructor.

Constructs a copy of the global locale. If no locale has been explicitly set, this is the C locale.

Copy constructor.

Constructs a copy of other.

Parameters
__otherThe locale to copy.

Named locale constructor.

Constructs a copy of the named C library locale.

Parameters
__sName of the locale to construct.
Exceptions
std::runtime_errorif __s is null or an undefined locale.

Construct locale with facets from another locale.

Constructs a copy of the locale base. The facets specified by cat are replaced with those from the locale named by s. If base is named, this locale instance will also be named.

Parameters
__baseThe locale to copy.
__sName of the locale to use facets from.
__catSet of categories defining the facets to use from __s.
Exceptions
std::runtime_errorif __s is null or an undefined locale.

Construct locale with facets from another locale.

Constructs a copy of the locale base. The facets specified by cat are replaced with those from the locale add. If base and add are named, this locale instance will also be named.

Parameters
__baseThe locale to copy.
__addThe locale to use facets from.
__catSet of categories defining the facets to use from add.

Construct locale with another facet.

Constructs a copy of the locale __other. The facet __f is added to __other, replacing an existing facet of type Facet if there is one. If __f is null, this locale is a copy of __other.

Parameters
__otherThe locale to copy.
__fThe facet to add in.

Locale destructor.

Assignment operator.

Set this locale to be a copy of other.

Parameters
__otherThe locale to copy.
Returns
A reference to this locale.

Construct locale with another facet.

Constructs and returns a new copy of this locale. Adds or replaces an existing facet of type Facet from the locale other into the new locale.

Template Parameters
_FacetThe facet type to copy from other
Parameters
__otherThe locale to copy from.
Returns
Newly constructed locale.
Exceptions
std::runtime_errorif __other has no facet of type _Facet.

Return locale name.

Returns
Locale name or "*" if unnamed.

Locale equality.

Parameters
__otherThe locale to compare against.
Returns
True if other and this refer to the same locale instance, are copies, or have the same name. False otherwise.

Locale inequality.

Parameters
__otherThe locale to compare against.
Returns
! (*this == __other)

Compare two strings according to collate.

Template operator to compare two strings using the compare function of the collate facet in this locale. One use is to provide the locale to the sort function. For example, a vector v of strings could be sorted according to locale loc by doing:

std::sort(v.begin(), v.end(), loc);
Parameters
__s1First string to compare.
__s2Second string to compare.
Returns
True if collate<_Char> facet compares __s1 < __s2, else false.

Set global locale

This function sets the global locale to the argument and returns a copy of the previous global locale. If the argument has a name, it will also call std::setlocale(LC_ALL, loc.name()).

Parameters
__locThe new locale to make global.
Returns
Copy of the old global locale.

Return reference to the C locale.

Localization functionality base class.

The facet class is the base class for a localization feature, such as money, time, and number printing. It provides common support for facets and reference management.

Facets may not be copied or assigned.

Facet constructor.

This is the constructor provided by the standard. If refs is 0, the facet is destroyed when the last referencing locale is destroyed. Otherwise the facet will never be destroyed.

Parameters
__refsThe initial value for reference count.

Facet destructor.

Facet ID class.

The ID class provides facets with an index used to identify them. Every facet class must define a public static member locale::id, or be derived from a facet that provides this member, otherwise the facet cannot be used in a locale. The locale::id ensures that each class type gets a unique identifier.

Constructor.

Facet for localized string comparison.

This facet encapsulates the code to compare strings in a localized manner.

The collate template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the collate facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__refsPassed to the base facet class.

Compare two strings.

This function compares two strings and returns the result by calling collate::do_compare().

Parameters
__lo1Start of string 1.
__hi1End of string 1.
__lo2Start of string 2.
__hi2End of string 2.
Returns
1 if string1 > string2, -1 if string1 < string2, else 0.

Transform string to comparable form.

This function is a wrapper for strxfrm functionality. It takes the input string and returns a modified string that can be directly compared to other transformed strings. In the C locale, this function just returns a copy of the input string. In some other locales, it may replace two chars with one, change a char for another, etc. It does so by returning collate::do_transform().

Parameters
__loStart of string.
__hiEnd of string.
Returns
Transformed string_type.

Return hash of a string.

This function computes and returns a hash on the input string. It does so by returning collate::do_hash().

Parameters
__loStart of string.
__hiEnd of string.
Returns
Hash value.

Destructor.

Compare two strings.

This function is a hook for derived classes to change the value returned.

See also
compare().
Parameters
__lo1Start of string 1.
__hi1End of string 1.
__lo2Start of string 2.
__hi2End of string 2.
Returns
1 if string1 > string2, -1 if string1 < string2, else 0.

Transform string to comparable form.

This function is a hook for derived classes to change the value returned.

Parameters
__loStart.
__hiEnd.
Returns
transformed string.

Return hash of a string.

This function computes and returns a hash on the input string. This function is a hook for derived classes to change the value returned.

Parameters
__loStart of string.
__hiEnd of string.
Returns
Hash value.

class collate_byname [22.2.4.2].

Public typedefs

Test for the presence of a facet.

has_facet tests the locale argument for the presence of the facet type provided as the template parameter. Facets derived from the facet parameter will also return true.

Template Parameters
_FacetThe facet type to test the presence of.
Parameters
__locThe locale to test.
Returns
true if __loc contains a facet of type _Facet, else false.

Return a facet.

use_facet looks for and returns a reference to a facet of type Facet where Facet is the template parameter. If has_facet(locale) is true, there is a suitable facet to return. It throws std::bad_cast if the locale doesn't contain a facet of type Facet.

Template Parameters
_FacetThe facet type to access.
Parameters
__locThe locale to use.
Returns
Reference to facet of type Facet.
Exceptions
std::bad_castif __loc doesn't contain a facet of type _Facet.

The actual work of input and output (interface).

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.

This is a base class. Derived stream buffers each control a pair of character sequences: one for input, and one for output.

Section [27.5.1] of the standard describes the requirements and behavior of stream buffer classes. That section (three paragraphs) is reproduced here, for simplicity and accuracy.

  1. Stream buffers can impose various constraints on the sequences they control. Some constraints are:
    • The controlled input sequence can be not readable.
    • The controlled output sequence can be not writable.
    • The controlled sequences can be associated with the contents of other representations for character sequences, such as external files.
    • The controlled sequences can support operations directly to or from associated sequences.
    • The controlled sequences can impose limitations on how the program can read characters from a sequence, write characters to a sequence, put characters back into an input sequence, or alter the stream position.
  2. Each sequence is characterized by three pointers which, if non-null, all point into the same charT array object. The array object represents, at any moment, a (sub)sequence of characters from the sequence. Operations performed on a sequence alter the values stored in these pointers, perform reads and writes directly to or from associated sequences, and alter the stream position and conversion state as needed to maintain this subsequence relationship. The three pointers are:
    • the beginning pointer, or lowest element address in the array (called xbeg here);
    • the next pointer, or next element address that is a current candidate for reading or writing (called xnext here);
    • the end pointer, or first element address beyond the end of the array (called xend here).
  3. The following semantic constraints shall always apply for any set of three pointers for a sequence, using the pointer names given immediately above:
    • If xnext is not a null pointer, then xbeg and xend shall also be non-null pointers into the same charT array, as described above; otherwise, xbeg and xend shall also be null.
    • If xnext is not a null pointer and xnext < xend for an output sequence, then a write position is available. In this case, *xnext shall be assignable as the next element to write (to put, or to store a character value, into the sequence).
    • If xnext is not a null pointer and xbeg < xnext for an input sequence, then a putback position is available. In this case, xnext[-1] shall have a defined value and is the next (preceding) element to store a character that is put back into the input sequence.
    • If xnext is not a null pointer and xnext< xend for an input sequence, then a read position is available. In this case, *xnext shall have a defined value and is the next element to read (to get, or to obtain a character value, from the sequence).

These are standard types. They permit a standardized way of referring to names of (or names dependent on) the template parameters, which are specific to the implementation.

This is a non-standard type.

< Start of get area.

< Current read area.

< End of get area.

< Start of put area.

< Current put area.

< End of put area.

Current locale setting.

Destructor deallocates no buffer space.

Entry point for imbue().

Parameters
__locThe new locale.
Returns
The previous locale.

Calls the derived imbue(__loc).

Locale access.

Returns
The current locale in effect.

If pubimbue(loc) has been called, then the most recent loc is returned. Otherwise the global locale in effect at the time of construction is returned.

Entry points for derived buffer functions.

The public versions of pubfoo dispatch to the protected derived foo member functions, passing the arguments (if any) and returning the result unchanged.

Alters the stream position.

Parameters
__offOffset.
__wayValue for ios_base::seekdir.
__modeValue for ios_base::openmode.

Calls virtual seekoff function.

Alters the stream position.

Parameters
__spPosition
__modeValue for ios_base::openmode.

Calls virtual seekpos function.

Calls virtual sync function.

Looking ahead into the stream.

Returns
The number of characters available.

If a read position is available, returns the number of characters available for reading before the buffer must be refilled. Otherwise returns the derived showmanyc().

Getting the next character.

Returns
The next character, or eof.

Calls sbumpc(), and if that function returns traits::eof(), so does this function. Otherwise, sgetc().

Getting the next character.

Returns
The next character, or eof.

If the input read position is available, returns that character and increments the read pointer, otherwise calls and returns uflow().

Getting the next character.

Returns
The next character, or eof.

If the input read position is available, returns that character, otherwise calls and returns underflow(). Does not move the read position after fetching the character.

Entry point for xsgetn.

Parameters
__sA buffer area.
__nA count.

Returns xsgetn(__s,__n). The effect is to fill __s[0] through __s[__n-1] with characters from the input sequence, if possible.

Pushing characters back into the input stream.

Parameters
__cThe character to push back.
Returns
The previous character, if possible.

Similar to sungetc(), but __c is pushed onto the stream instead of the previous character. If successful, the next character fetched from the input stream will be __c.

Moving backwards in the input stream.

Returns
The previous character, if possible.

If a putback position is available, this function decrements the input pointer and returns that character. Otherwise, calls and returns pbackfail(). The effect is to unget the last character gotten.

Entry point for all single-character output functions.

Parameters
__cA character to output.
Returns
__c, if possible.

One of two public output functions.

If a write position is available for the output sequence (i.e., the buffer is not full), stores __c in that position, increments the position, and returns traits::to_int_type(__c). If a write position is not available, returns overflow(__c).

Entry point for all single-character output functions.

Parameters
__sA buffer read area.
__nA count.

One of two public output functions.

Returns xsputn(__s,__n). The effect is to write __s[0] through __s[__n-1] to the output sequence, if possible.

Base constructor.

Only called from derived constructors, and sets up all the buffer data to zero, including the pointers described in the basic_streambuf class description. Note that, as a result,

  • the class starts with no read nor write positions available,
  • this is not an error

Access to the get area.

These functions are only available to other protected functions, including derived classes.

  • eback() returns the beginning pointer for the input sequence
  • gptr() returns the next pointer for the input sequence
  • egptr() returns the end pointer for the input sequence

Moving the read position.

Parameters
__nThe delta by which to move.

This just advances the read position without returning any data.

Setting the three read area pointers.

Parameters
__gbegA pointer.
__gnextA pointer.
__gendA pointer.
Postcondition
__gbeg == eback(), __gnext == gptr(), and __gend == egptr()

Access to the put area.

These functions are only available to other protected functions, including derived classes.

  • pbase() returns the beginning pointer for the output sequence
  • pptr() returns the next pointer for the output sequence
  • epptr() returns the end pointer for the output sequence

Moving the write position.

Parameters
__nThe delta by which to move.

This just advances the write position without returning any data.

Setting the three write area pointers.

Parameters
__pbegA pointer.
__pendA pointer.
Postcondition
__pbeg == pbase(), __pbeg == pptr(), and __pend == epptr()

Changes translations.

Parameters
__locA new locale.

Translations done during I/O which depend on the current locale are changed by this call. The standard adds, Between invocations of this function a class derived from streambuf can safely cache results of calls to locale functions and to members of facets so obtained.

Note
Base class version does nothing.

Manipulates the buffer.

Each derived class provides its own appropriate behavior. See the next-to-last paragraph of https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering for more on this function.

Note
Base class version does nothing, returns this.

Alters the stream positions.

Each derived class provides its own appropriate behavior.

Note
Base class version does nothing, returns a pos_type that represents an invalid stream position.

Alters the stream positions.

Each derived class provides its own appropriate behavior.

Note
Base class version does nothing, returns a pos_type that represents an invalid stream position.

Synchronizes the buffer arrays with the controlled sequences.

Returns
-1 on failure.

Each derived class provides its own appropriate behavior, including the definition of failure.

Note
Base class version does nothing, returns zero.

Investigating the data available.

Returns
An estimate of the number of characters available in the input sequence, or -1.

If it returns a positive value, then successive calls to underflow() will not return traits::eof() until at least that number of characters have been supplied. If showmanyc() returns -1, then calls to underflow() or uflow() will fail. [27.5.2.4.3]/1

Note
Base class version does nothing, returns zero.
The standard adds that the intention is not only that the calls [to underflow or uflow] will not return eof() but that they will return immediately.
The standard adds that the morphemes of showmanyc are es-how-many-see, not show-manic.

Multiple character extraction.

Parameters
__sA buffer area.
__nMaximum number of characters to assign.
Returns
The number of characters assigned.

Fills __s[0] through __s[__n-1] with characters from the input sequence, as if by sbumpc(). Stops when either __n characters have been copied, or when traits::eof() would be copied.

It is expected that derived classes provide a more efficient implementation by overriding this definition.

Fetches more data from the controlled sequence.

Returns
The first character from the pending sequence.

Informally, this function is called when the input buffer is exhausted (or does not exist, as buffering need not actually be done). If a buffer exists, it is refilled. In either case, the next available character is returned, or traits::eof() to indicate a null pending sequence.

For a formal definition of the pending sequence, see a good text such as Langer & Kreft, or [27.5.2.4.3]/7-14.

A functioning input streambuf can be created by overriding only this function (no buffer area will be used). For an example, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html

Note
Base class version does nothing, returns eof().

Fetches more data from the controlled sequence.

Returns
The first character from the pending sequence.

Informally, this function does the same thing as underflow(), and in fact is required to call that function. It also returns the new character, like underflow() does. However, this function also moves the read position forward by one.

Tries to back up the input sequence.

Parameters
__cThe character to be inserted back into the sequence.
Returns
eof() on failure, some other value on success
Postcondition
The constraints of gptr(), eback(), and pptr() are the same as for underflow().
Note
Base class version does nothing, returns eof().

Multiple character insertion.

Parameters
__sA buffer area.
__nMaximum number of characters to write.
Returns
The number of characters written.

Writes __s[0] through __s[__n-1] to the output sequence, as if by sputc(). Stops when either n characters have been copied, or when sputc() would return traits::eof().

It is expected that derived classes provide a more efficient implementation by overriding this definition.

Consumes data from the buffer; writes to the controlled sequence.

Parameters
__cAn additional character to consume.
Returns
eof() to indicate failure, something else (usually __c, or not_eof())

Informally, this function is called when the output buffer is full (or does not exist, as buffering need not actually be done). If a buffer exists, it is consumed, with some effect on the controlled sequence. (Typically, the buffer is written out to the sequence verbatim.) In either case, the character c is also written out, if __c is not eof().

For a formal definition of this function, see a good text such as Langer & Kreft, or [27.5.2.4.5]/3-7.

A functioning output streambuf can be created by overriding only this function (no buffer area will be used).

Note
Base class version does nothing, returns eof().

Tosses a character.

Advances the read pointer, ignoring the character that would have been read.

See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html

Base class for ctype.

Primary class template numpunct.

This facet stores several pieces of information related to printing and scanning numbers, such as the decimal point character. It takes a template parameter specifying the char type. The numpunct facet is used by streams for many I/O operations involving numbers.

The numpunct template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from a numpunct facet.

Public typedefs

Numpunct facet id.

Numpunct constructor.

Parameters
__refsRefcount to pass to the base class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up the predefined locale facets.

Parameters
__cache__numpunct_cache object.
__refsRefcount to pass to the base class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__refsRefcount to pass to the base class.

Return decimal point character.

This function returns a char_type to use as a decimal point. It does so by returning returning numpunct<char_type>::do_decimal_point().

Returns
char_type representing a decimal point.

Return thousands separator character.

This function returns a char_type to use as a thousands separator. It does so by returning returning numpunct<char_type>::do_thousands_sep().

Returns
char_type representing a thousands separator.

Return grouping specification.

This function returns a string representing groupings for the integer part of a number. Groupings indicate where thousands separators should be inserted in the integer part of a number.

Each char in the return string is interpret as an integer rather than a character. These numbers represent the number of digits in a group. The first char in the string represents the number of digits in the least significant group. If a char is negative, it indicates an unlimited number of digits for the group. If more chars from the string are required to group a number, the last char is used repeatedly.

For example, if the grouping() returns "\003\002" and is applied to the number 123456789, this corresponds to 12,34,56,789. Note that if the string was "32", this would put more than 50 digits into the least significant group if the character set is ASCII.

The string is returned by calling numpunct<char_type>::do_grouping().

Returns
string representing grouping specification.

Return string representation of bool true.

This function returns a string_type containing the text representation for true bool variables. It does so by calling numpunct<char_type>::do_truename().

Returns
string_type representing printed form of true.

Return string representation of bool false.

This function returns a string_type containing the text representation for false bool variables. It does so by calling numpunct<char_type>::do_falsename().

Returns
string_type representing printed form of false.

Destructor.

Return decimal point character.

Returns a char_type to use as a decimal point. This function is a hook for derived classes to change the value returned.

Returns
char_type representing a decimal point.

Return thousands separator character.

Returns a char_type to use as a thousands separator. This function is a hook for derived classes to change the value returned.

Returns
char_type representing a thousands separator.

Return grouping specification.

Returns a string representing groupings for the integer part of a number. This function is a hook for derived classes to change the value returned.

See also
grouping() for details.
Returns
String representing grouping specification.

Return string representation of bool true.

Returns a string_type containing the text representation for true bool variables. This function is a hook for derived classes to change the value returned.

Returns
string_type representing printed form of true.

Return string representation of bool false.

Returns a string_type containing the text representation for false bool variables. This function is a hook for derived classes to change the value returned.

Returns
string_type representing printed form of false.

class numpunct_byname [22.2.3.2].

Primary class template num_get.

This facet encapsulates the code to parse and return a number from a string. It is used by the istream numeric extraction operators.

The num_get template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the num_get facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Numeric parsing.

Parses the input stream into the bool v. It does so by calling num_get::do_get().

If ios_base::boolalpha is set, attempts to read ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets v to true or false if successful. Sets err to ios_base::failbit if reading the string fails. Sets err to ios_base::eofbit if the stream is emptied.

If ios_base::boolalpha is not set, proceeds as with reading a long, except if the value is 1, sets v to true, if the value is 0, sets v to false, and otherwise set err to ios_base::failbit.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the integral variable v. It does so by calling num_get::do_get().

Parsing is affected by the flag settings in io.

The basic parse is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, parses like the scanf o specifier. Else if equal to ios_base::hex, parses like X specifier. Else if basefield equal to 0, parses like the i specifier. Otherwise, parses like d for signed and u for unsigned types. The matching type length modifier is also used.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the integral variable v. It does so by calling num_get::do_get().

The input characters are parsed like the scanf g specifier. The matching type length modifier is also used.

The decimal point character used is numpunct::decimal_point(). Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the pointer variable v. It does so by calling num_get::do_get().

The input characters are parsed like the scanf p specifier.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

Note that the digit grouping effect for pointers is a bit ambiguous in the standard and shouldn't be relied on. See DR 344.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Destructor.

Numeric parsing.

Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also
get() for more details.
Parameters
__begStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Primary class template num_put.

This facet encapsulates the code to convert a number to a string. It is used by the ostream numeric insertion operators.

The num_put template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the num_put facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Numeric formatting.

Formats the boolean v and inserts it into a stream. It does so by calling num_put::do_put().

If ios_base::boolalpha is set, writes ctype<CharT>::truename() or ctype<CharT>::falsename(). Otherwise formats v as an int.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the integral value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, formats like the printf o specifier. Else if equal to ios_base::hex, formats like x or X with ios_base::uppercase unset or set respectively. Otherwise, formats like d, ld, lld for signed and u, lu, llu for unsigned values. Note that if both oct and hex are set, neither will take effect.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showbase is set, '0' precedes octal values (except 0) and '0[xX]' precedes hex values.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the floating point value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::floatfield. If equal to ios_base::fixed, formats like the printf f specifier. Else if equal to ios_base::scientific, formats like e or E with ios_base::uppercase unset or set respectively. Otherwise, formats like g or G depending on uppercase. Note that if both fixed and scientific are set, the effect will also be like g or G.

The output precision is given by io.precision(). This precision is capped at numeric_limits::digits10 + 2 (different for double and long double). The default precision is 6.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showpoint is set, a decimal point will always be output.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the pointer value v and inserts it into a stream. It does so by calling num_put::do_put().

This function formats v as an unsigned long with ios_base::hex and ios_base::showbase set.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Destructor.

Numeric formatting.

These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Convenience interface to ctype.is(ctype_base::space, __c).

Convenience interface to ctype.is(ctype_base::print, __c).

Convenience interface to ctype.is(ctype_base::cntrl, __c).

Convenience interface to ctype.is(ctype_base::upper, __c).

Convenience interface to ctype.is(ctype_base::lower, __c).

Convenience interface to ctype.is(ctype_base::alpha, __c).

Convenience interface to ctype.is(ctype_base::digit, __c).

Convenience interface to ctype.is(ctype_base::punct, __c).

Convenience interface to ctype.is(ctype_base::xdigit, __c).

Convenience interface to ctype.is(ctype_base::alnum, __c).

Convenience interface to ctype.is(ctype_base::graph, __c).

Convenience interface to ctype.toupper(__c).

Convenience interface to ctype.tolower(__c).

Template class basic_ios, virtual base class for all stream classes.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.

Most of the member functions called dispatched on stream objects (e.g., std::cout.foo(bar);) are consolidated in this class.

These are standard types. They permit a standardized way of referring to names of (or names dependent on) the template parameters, which are specific to the implementation.

These are non-standard types.

The quick-and-easy status check.

This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ...

Returns the error state of the stream buffer.

Returns
A bit pattern (well, isn't everything?)

See std::ios_base::iostate for the possible bit values. Most users will call one of the interpreting wrappers, e.g., good().

[Re]sets the error state.

Parameters
__stateThe new state flag(s) to set.

See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument.

Sets additional flags in the error state.

Parameters
__stateThe additional state flag(s) to set.

See std::ios_base::iostate for the possible bit values.

Fast error checking.

Returns
True if no error flags are set.

A wrapper around rdstate.

Fast error checking.

Returns
True if the eofbit is set.

Note that other iostate flags may also be set.

Fast error checking.

Returns
True if either the badbit or the failbit is set.

Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set.

Fast error checking.

Returns
True if the badbit is set.

Note that other iostate flags may also be set.

Throwing exceptions on errors.

Returns
The current exceptions mask.

This changes nothing in the stream. See the one-argument version of exceptions(iostate) for the meaning of the return value.

Throwing exceptions on errors.

Parameters
__exceptThe new exceptions mask.

By default, error flags are set silently. You can set an exceptions mask for each stream; if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown.

If the error flag is already set when the exceptions mask is added, the exception is immediately thrown. Try running the following under GCC 3.1 or later:

#include <iostream>
#include <fstream>
#include <exception>
int main()
{
std::ifstream f ("/etc/motd");
std::cerr << "Setting badbit\n";
f.setstate (std::ios_base::badbit);
std::cerr << "Setting exception mask\n";
f.exceptions (std::ios_base::badbit);
}

Constructor performs initialization.

The parameter is passed by derived streams.

Empty.

The destructor does nothing. More specifically, it does not destroy the streambuf held by rdbuf().

Fetches the current tied stream.

Returns
A pointer to the tied stream, or NULL if the stream is not tied.

A stream may be tied (or synchronized) to a second output stream. When this stream performs any I/O, the tied stream is first flushed. For example, std::cin is tied to std::cout.

Ties this stream to an output stream.

Parameters
__tiestrThe output stream.
Returns
The previously tied output stream, or NULL if the stream was not tied.

This sets up a new tie; see tie() for more.

Accessing the underlying buffer.

Returns
The current stream buffer.

This does not change the state of the stream.

Changing the underlying buffer.

Parameters
__sbThe new stream buffer.
Returns
The previous stream buffer.

Associates a new buffer with the current stream, and clears the error state.

Due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error: this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. As a result, you must use explicit qualifications to access this function via any derived class. For example:

std::fstream foo; // or some other derived type
std::streambuf* p = .....;
foo.ios::rdbuf(p); // ios == basic_ios<char>

Copies fields of __rhs into this.

Parameters
__rhsThe source values for the copies.
Returns
Reference to this object.

All fields of __rhs are copied into this object except that rdbuf() and rdstate() remain unchanged. All values in the pword and iword arrays are copied. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. The final step is to copy exceptions().

Retrieves the empty character.

Returns
The current fill character.

It defaults to a space (' ') in the current locale.

Sets a new empty character.

Parameters
__chThe new character.
Returns
The previous fill character.

The fill character is used to fill out space when P+ characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. It defaults to a space (' ') in the current locale.

Moves to a new locale.

Parameters
__locThe new locale.
Returns
The previous locale.

Calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, calls that buffer's pubimbue(loc).

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Squeezes characters.

Parameters
__cThe character to narrow.
__dfaultThe character to narrow.
Returns
The narrowed character.

Maps a character of char_type to a character of char, if possible.

Returns the result of

std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Widens characters.

Parameters
__cThe character to widen.
Returns
The widened character.

Maps a character of char to a character of char_type.

Returns the result of

std::use_facet<ctype<char_type> >(getloc()).widen(c)

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Empty.

The default constructor does nothing and is not normally accessible to users.

All setup is performed here.

This is called from the public constructor. It is not virtual and cannot be redefined.

Constructs an object in existing memory by invoking an allocated object's constructor with an initializer.

Destroy the object pointed to by a pointer type.

Destroy a range of objects. If the value_type of the object has a trivial destructor, the compiler should optimize all of this away, otherwise the objects' destructors must be invoked.

Destroy a range of objects using the supplied allocator. For nondefault allocators we do not optimize away invocation of destroy() even if _Tp has a trivial destructor.

Swaps the median value of *__a, *__b and *__c under __comp to *__result

This is an overload used by find algos for the Input Iterator case.

This is an overload used by find algos for the RAI case.

Provided for stable_partition to use.

Like find_if_not(), but uses and updates a count of the remaining range length instead of comparing against an end iterator.

This is an helper function for search_n overloaded for forward iterators.

This is an helper function for search_n overloaded for random access iterators.

Find last matching subsequence in a sequence.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of sequence to match.
__last2End of sequence to match.
Returns
The last iterator i in the range [__first1,__last1-(__last2-__first2)) such that *(i+N) == *(__first2+N) for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2) and returns an iterator to the __first element of the sub-sequence, or __last1 if the sub-sequence is not found. The sub-sequence will be the last such subsequence contained in [__first1,__last1).

Because the sub-sequence must lie completely within the range [__first1,__last1) it must start at a position less than __last1-(__last2-__first2) where __last2-__first2 is the length of the sub-sequence. This means that the returned iterator i will be in the range [__first1,__last1-(__last2-__first2))

Find last matching subsequence in a sequence using a predicate.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of sequence to match.
__last2End of sequence to match.
__compThe predicate to use.
Returns
The last iterator i in the range [__first1,__last1-(__last2-__first2)) such that predicate(*(i+N), (__first2+N)) is true for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2) using comp as a predicate and returns an iterator to the first element of the sub-sequence, or __last1 if the sub-sequence is not found. The sub-sequence will be the last such subsequence contained in [__first,__last1).

Because the sub-sequence must lie completely within the range [__first1,__last1) it must start at a position less than __last1-(__last2-__first2) where __last2-__first2 is the length of the sub-sequence. This means that the returned iterator i will be in the range [__first1,__last1-(__last2-__first2))

Copy a sequence, removing elements of a given value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__valueThe value to be removed.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) not equal to __value to the range beginning at __result. remove_copy() is stable, so the relative order of elements that are copied is unchanged.

Copy a sequence, removing elements for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__predA predicate.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) for which __pred returns false to the range beginning at __result.

remove_copy_if() is stable, so the relative order of elements that are copied is unchanged.

Remove elements from a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__valueThe value to be removed.
Returns
An iterator designating the end of the resulting sequence.

All elements equal to __value are removed from the range [__first,__last).

remove() is stable, so the relative order of elements that are not removed is unchanged.

Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

Remove elements from a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate.
Returns
An iterator designating the end of the resulting sequence.

All elements for which __pred returns true are removed from the range [__first,__last).

remove_if() is stable, so the relative order of elements that are not removed is unchanged.

Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

Remove consecutive duplicate values from a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
An iterator designating the end of the resulting sequence.

Removes all but the first element from each group of consecutive values that compare equal. unique() is stable, so the relative order of elements that are not removed is unchanged. Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

Remove consecutive values from a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__binary_predA binary predicate.
Returns
An iterator designating the end of the resulting sequence.

Removes all but the first element from each group of consecutive values for which __binary_pred returns true. unique() is stable, so the relative order of elements that are not removed is unchanged. Elements between the end of the resulting sequence and __last are still present, but their value is unspecified.

This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator, _BinaryPredicate) overloaded for forward iterators and output iterator as result.

This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator, _BinaryPredicate) overloaded for input iterators and output iterator as result.

This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator, _BinaryPredicate) overloaded for input iterators and forward iterator as result.

This is an uglified reverse(_BidirectionalIterator, _BidirectionalIterator) overloaded for bidirectional iterators.

This is an uglified reverse(_BidirectionalIterator, _BidirectionalIterator) overloaded for random access iterators.

Reverse a sequence.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
Returns
reverse() returns no value.

Reverses the order of the elements in the range [__first,__last), so that the first element becomes the last etc. For every i such that 0<=i<=(__last-__first)/2), reverse() swaps *(__first+i) and *(__last-(i+1))

Copy a sequence, reversing its elements.

Parameters
__firstA bidirectional iterator.
__lastA bidirectional iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies the elements in the range [__first,__last) to the range [__result,__result+(__last-__first)) such that the order of the elements is reversed. For every i such that 0<=i<=(__last-__first), reverse_copy() performs the assignment *(__result+(__last-__first)-1-i) = *(__first+i). The ranges [__first,__last) and [__result,__result+(__last-__first)) must not overlap.

This is a helper function for the rotate algorithm specialized on RAIs. It returns the greatest common divisor of two integer values.

This is a helper function for the rotate algorithm.

This is a helper function for the rotate algorithm.

This is a helper function for the rotate algorithm.

Rotate the elements of a sequence.

Parameters
__firstA forward iterator.
__middleA forward iterator.
__lastA forward iterator.
Returns
first + (last - middle).

Rotates the elements of the range [__first,__last) by (__middle - __first) positions so that the element at __middle is moved to __first, the element at __middle+1 is moved to __first+1 and so on for each element in the range [__first,__last).

This effectively swaps the ranges [__first,__middle) and [__middle,__last).

Performs *(__first+(n+(__last-__middle))%(__last-__first))=*(__first+n) for each n in the range [0,__last-__first).

Copy a sequence, rotating its elements.

Parameters
__firstA forward iterator.
__middleA forward iterator.
__lastA forward iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies the elements of the range [__first,__last) to the range beginning at

Returns
, rotating the copied elements by (__middle-__first) positions so that the element at __middle is moved to __result, the element at __middle+1 is moved to __result+1 and so on for each element in the range [__first,__last).

Performs *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n) for each n in the range [0,__last-__first).

This is a helper function...

This is a helper function...

This is a helper function... Requires __first != __last and !__pred(__first) and __len == distance(__first, __last).

!__pred(__first) allows us to guarantee that we don't move-assign an element onto itself.

Move elements for which a predicate is true to the beginning of a sequence, preserving relative ordering.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate functor.
Returns
An iterator middle such that __pred(i) is true for each iterator i in the range [first,middle) and false for each i in the range [middle,last).

Performs the same function as partition() with the additional guarantee that the relative ordering of elements in each group is preserved, so any two elements x and y in the range [__first,__last) such that __pred(x)==__pred(y) will have the same relative ordering after calling stable_partition().

This is a helper function for the sort routines.

Copy the smallest elements of a sequence.

Parameters
__firstAn iterator.
__lastAnother iterator.
__result_firstA random-access iterator.
__result_lastAnother random-access iterator.
Returns
An iterator indicating the end of the resulting sequence.

Copies and sorts the smallest N values from the range [__first,__last) to the range beginning at __result_first, where the number of elements to be copied, N, is the smaller of (__last-__first) and (__result_last-__result_first). After the sort if i and j are iterators in the range [__result_first,__result_first+N) such that i precedes j then *j<*i is false. The value returned is __result_first+N.

Copy the smallest elements of a sequence using a predicate for comparison.

Parameters
__firstAn input iterator.
__lastAnother input iterator.
__result_firstA random-access iterator.
__result_lastAnother random-access iterator.
__compA comparison functor.
Returns
An iterator indicating the end of the resulting sequence.

Copies and sorts the smallest N values from the range [__first,__last) to the range beginning at result_first, where the number of elements to be copied, N, is the smaller of (__last-__first) and (__result_last-__result_first). After the sort if i and j are iterators in the range [__result_first,__result_first+N) such that i precedes j then __comp(*j,*i) is false. The value returned is __result_first+N.

This is a helper function for the sort routine.

This is a helper function for the sort routine.

This is a helper function for the sort routine.

This controls some aspect of the sort routines.

This is a helper function for the sort routine.

This is a helper function...

This is a helper function...

This is a helper function for the sort routine.

Finds the first position in which __val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
An iterator pointing to the first element not less than __val, or end() if every element is less than __val.

The comparison function should have the same effects on ordering as the function used for the initial sort.

Finds the last position in which __val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
An iterator pointing to the first element greater than __val, or end() if no elements are greater than __val.

Finds the last position in which __val could be inserted without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
An iterator pointing to the first element greater than __val, or end() if no elements are greater than __val.

The comparison function should have the same effects on ordering as the function used for the initial sort.

Finds the largest subrange in which __val could be inserted at any place in it without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
An pair of iterators defining the subrange.

This is equivalent to

std::make_pair(lower_bound(__first, __last, __val),
upper_bound(__first, __last, __val))

but does not actually call those functions.

Finds the largest subrange in which __val could be inserted at any place in it without changing the ordering.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
An pair of iterators defining the subrange.

This is equivalent to

std::make_pair(lower_bound(__first, __last, __val, __comp),
upper_bound(__first, __last, __val, __comp))

but does not actually call those functions.

Determines whether an element exists in a range.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
Returns
True if __val (or its equivalent) is in [__first,__last ].

Note that this does not actually return an iterator to __val. For that, use std::find or a container's specialized find member functions.

Determines whether an element exists in a range.

Parameters
__firstAn iterator.
__lastAnother iterator.
__valThe search term.
__compA functor to use for comparisons.
Returns
True if __val (or its equivalent) is in [__first,__last].

Note that this does not actually return an iterator to __val. For that, use std::find or a container's specialized find member functions.

The comparison function should have the same effects on ordering as the function used for the initial sort.

This is a helper function for the __merge_adaptive routines.

This is a helper function for the __merge_adaptive routines.

This is a helper function for the merge routines.

This is a helper function for the merge routines.

This is a helper function for the merge routines.

Merges two sorted ranges in place.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
Returns
Nothing.

Merges two sorted and consecutive ranges, [__first,__middle) and [__middle,__last), and puts the result in [__first,__last). The output will be sorted. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

If enough additional memory is available, this takes (__last-__first)-1 comparisons. Otherwise an NlogN algorithm is used, where N is distance(__first,__last).

Merges two sorted ranges in place.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
__compA functor to use for comparisons.
Returns
Nothing.

Merges two sorted and consecutive ranges, [__first,__middle) and [middle,last), and puts the result in [__first,__last). The output will be sorted. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

If enough additional memory is available, this takes (__last-__first)-1 comparisons. Otherwise an NlogN algorithm is used, where N is distance(__first,__last).

The comparison function should have the same effects on ordering as the function used for the initial sort.

This is a helper function for the __merge_sort_loop routines.

This is a helper function for the stable sorting routines.

Determines whether all elements of a sequence exists in a range.

Parameters
__first1Start of search range.
__last1End of search range.
__first2Start of sequence
__last2End of sequence.
Returns
True if each element in [__first2,__last2) is contained in order within [__first1,__last1). False otherwise.

This operation expects both [__first1,__last1) and [__first2,__last2) to be sorted. Searches for the presence of each element in [__first2,__last2) within [__first1,__last1). The iterators over each range only move forward, so this is a linear algorithm. If an element in [__first2,__last2) is not found before the search iterator reaches __last2, false is returned.

Determines whether all elements of a sequence exists in a range using comparison.

Parameters
__first1Start of search range.
__last1End of search range.
__first2Start of sequence
__last2End of sequence.
__compComparison function to use.
Returns
True if each element in [__first2,__last2) is contained in order within [__first1,__last1) according to comp. False otherwise.

This operation expects both [__first1,__last1) and [__first2,__last2) to be sorted. Searches for the presence of each element in [__first2,__last2) within [__first1,__last1), using comp to decide. The iterators over each range only move forward, so this is a linear algorithm. If an element in [__first2,__last2) is not found before the search iterator reaches __last2, false is returned.

Permute range into the next dictionary ordering.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
False if wrapped to first permutation, true otherwise.

Treats all permutations of the range as a set of dictionary sorted sequences. Permutes the current sequence into the next one of this set. Returns true if there are more sequences to generate. If the sequence is the largest of the set, the smallest is generated and false returned.

Permute range into the next dictionary ordering using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compA comparison functor.
Returns
False if wrapped to first permutation, true otherwise.

Treats all permutations of the range [__first,__last) as a set of dictionary sorted sequences ordered by __comp. Permutes the current sequence into the next one of this set. Returns true if there are more sequences to generate. If the sequence is the largest of the set, the smallest is generated and false returned.

Permute range into the previous dictionary ordering.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
False if wrapped to last permutation, true otherwise.

Treats all permutations of the range as a set of dictionary sorted sequences. Permutes the current sequence into the previous one of this set. Returns true if there are more sequences to generate. If the sequence is the smallest of the set, the largest is generated and false returned.

Permute range into the previous dictionary ordering using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compA comparison functor.
Returns
False if wrapped to last permutation, true otherwise.

Treats all permutations of the range [__first,__last) as a set of dictionary sorted sequences ordered by __comp. Permutes the current sequence into the previous one of this set. Returns true if there are more sequences to generate. If the sequence is the smallest of the set, the largest is generated and false returned.

Copy a sequence, replacing each element of one value with another value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__old_valueThe value to be replaced.
__new_valueThe replacement value.
Returns
The end of the output sequence, result+(last-first).

Copies each element in the input range [__first,__last) to the output range [__result,__result+(__last-__first)) replacing elements equal to __old_value with __new_value.

Copy a sequence, replacing each value for which a predicate returns true with another value.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__predA predicate.
__new_valueThe replacement value.
Returns
The end of the output sequence, __result+(__last-__first).

Copies each element in the range [__first,__last) to the range [__result,__result+(__last-__first)) replacing elements for which __pred returns true with __new_value.

Apply a function to every element of a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__fA unary function object.
Returns
__f (std::move(__f) in C++0x).

Applies the function object __f to each element in the range [first,last). __f must not modify the order of the sequence. If __f has a return value it is ignored.

Find the first occurrence of a value in a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__valThe value to find.
Returns
The first iterator i in the range [__first,__last) such that *i == __val, or __last if no such iterator exists.

Find the first element in a sequence for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__predA predicate.
Returns
The first iterator i in the range [__first,__last) such that __pred(*i) is true, or __last if no such iterator exists.

Find element from a set in a sequence.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of match candidates.
__last2End of match candidates.
Returns
The first iterator i in the range [__first1,__last1) such that *i == *(i2) such that i2 is an iterator in [__first2,__last2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for an element that is equal to some element in the range [__first2,__last2). If found, returns an iterator in the range [__first1,__last1), otherwise returns __last1.

Find element from a set in a sequence using a predicate.

Parameters
__first1Start of range to search.
__last1End of range to search.
__first2Start of match candidates.
__last2End of match candidates.
__compPredicate to use.
Returns
The first iterator i in the range [__first1,__last1) such that comp(*i, *(i2)) is true and i2 is an iterator in [__first2,__last2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for an element that is equal to some element in the range [__first2,__last2). If found, returns an iterator in the range [__first1,__last1), otherwise returns __last1.

Find two adjacent values in a sequence that are equal.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
The first iterator i such that i and i+1 are both valid iterators in [__first,__last) and such that *i == *(i+1), or __last if no such iterator exists.

Find two adjacent values in a sequence using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__binary_predA binary predicate.
Returns
The first iterator i such that i and i+1 are both valid iterators in [__first,__last) and such that __binary_pred(i,(i+1)) is true, or __last if no such iterator exists.

Count the number of copies of a value in a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__valueThe value to be counted.
Returns
The number of iterators i in the range [__first,__last) for which *i == __value

Count the elements of a sequence for which a predicate is true.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__predA predicate.
Returns
The number of iterators i in the range [__first,__last) for which __pred(*i) is true.

Search a sequence for a matching sub-sequence.

Parameters
__first1A forward iterator.
__last1A forward iterator.
__first2A forward iterator.
__last2A forward iterator.
Returns
The first iterator i in the range [__first1,__last1-(__last2-__first2)) such that *(i+N) == *(__first2+N) for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2) and returns an iterator to the first element of the sub-sequence, or __last1 if the sub-sequence is not found.

Because the sub-sequence must lie completely within the range [__first1,__last1) it must start at a position less than __last1-(__last2-__first2) where __last2-__first2 is the length of the sub-sequence.

This means that the returned iterator i will be in the range [__first1,__last1-(__last2-__first2))

Search a sequence for a matching sub-sequence using a predicate.

Parameters
__first1A forward iterator.
__last1A forward iterator.
__first2A forward iterator.
__last2A forward iterator.
__predicateA binary predicate.
Returns
The first iterator i in the range [__first1,__last1-(__last2-__first2)) such that __predicate(*(i+N),*(__first2+N)) is true for each N in the range [0,__last2-__first2), or __last1 if no such iterator exists.

Searches the range [__first1,__last1) for a sub-sequence that compares equal value-by-value with the sequence given by [__first2,__last2), using __predicate to determine equality, and returns an iterator to the first element of the sub-sequence, or __last1 if no such iterator exists.

See also
search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2)

Search a sequence for a number of consecutive values.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__countThe number of consecutive values.
__valThe value to find.
Returns
The first iterator i in the range [__first,__last-__count) such that *(i+N) == __val for each N in the range [0,__count), or __last if no such iterator exists.

Searches the range [__first,__last) for count consecutive elements equal to __val.

Search a sequence for a number of consecutive values using a predicate.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__countThe number of consecutive values.
__valThe value to find.
__binary_predA binary predicate.
Returns
The first iterator i in the range [__first,__last-__count) such that __binary_pred(*(i+N),__val) is true for each N in the range [0,__count), or __last if no such iterator exists.

Searches the range [__first,__last) for __count consecutive elements for which the predicate returns true.

Perform an operation on a sequence.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__unary_opA unary operator.
Returns
An output iterator equal to __result+(__last-__first).

Applies the operator to each element in the input range and assigns the results to successive elements of the output sequence. Evaluates *(__result+N)=unary_op(*(__first+N)) for each N in the range [0,__last-__first).

unary_op must not alter its argument.

Perform an operation on corresponding elements of two sequences.

Parameters
__first1An input iterator.
__last1An input iterator.
__first2An input iterator.
__resultAn output iterator.
__binary_opA binary operator.
Returns
An output iterator equal to result+(last-first).

Applies the operator to the corresponding elements in the two input ranges and assigns the results to successive elements of the output sequence. Evaluates *(__result+N)=__binary_op(*(__first1+N),*(__first2+N)) for each N in the range [0,__last1-__first1).

binary_op must not alter either of its arguments.

Replace each occurrence of one value in a sequence with another value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__old_valueThe value to be replaced.
__new_valueThe replacement value.
Returns
replace() returns no value.

For each iterator i in the range [__first,__last) if *i == __old_value then the assignment *i = __new_value is performed.

Replace each value in a sequence for which a predicate returns true with another value.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate.
__new_valueThe replacement value.
Returns
replace_if() returns no value.

For each iterator i in the range [__first,__last) if __pred(*i) is true then the assignment *i = __new_value is performed.

Assign the result of a function object to each value in a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__genA function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type
Returns
generate() returns no value.

Performs the assignment *i = __gen() for each i in the range [__first,__last).

Assign the result of a function object to each value in a sequence.

Parameters
__firstA forward iterator.
__nThe length of the sequence.
__genA function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type
Returns
The end of the sequence, __first+__n

Performs the assignment *i = __gen() for each i in the range [__first,__first+__n).

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 865. More algorithms that throw away information

Copy a sequence, removing consecutive duplicate values.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) to the range beginning at __result, except that only the first element is copied from groups of consecutive elements that compare equal. unique_copy() is stable, so the relative order of elements that are copied is unchanged.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 241. Does unique_copy() require CopyConstructible and Assignable?

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 538. 241 again: Does unique_copy() require CopyConstructible and Assignable?

Copy a sequence, removing consecutive values using a predicate.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
__binary_predA binary predicate.
Returns
An iterator designating the end of the resulting sequence.

Copies each element in the range [__first,__last) to the range beginning at __result, except that only the first element is copied from groups of consecutive elements for which __binary_pred returns true. unique_copy() is stable, so the relative order of elements that are copied is unchanged.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 241. Does unique_copy() require CopyConstructible and Assignable?

Randomly shuffle the elements of a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
Returns
Nothing.

Reorder the elements in the range [__first,__last) using a random distribution, so that every possible ordering of the sequence is equally likely.

Shuffle the elements of a sequence using a random number generator.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__randThe RNG functor or function.
Returns
Nothing.

Reorders the elements in the range [__first,__last) using __rand to provide a random distribution. Calling __rand(N) for a positive integer N should return a randomly chosen integer from the range [0,N).

Move elements for which a predicate is true to the beginning of a sequence.

Parameters
__firstA forward iterator.
__lastA forward iterator.
__predA predicate functor.
Returns
An iterator middle such that __pred(i) is true for each iterator i in the range [__first,middle) and false for each i in the range [middle,__last).

__pred must not modify its operand. partition() does not preserve the relative ordering of elements in each group, use stable_partition() if this is needed.

Sort the smallest elements of a sequence.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
Returns
Nothing.

Sorts the smallest (__middle-__first) elements in the range [first,last) and moves them to the range [__first,__middle). The order of the remaining elements in the range [__middle,__last) is undefined. After the sort if i and j are iterators in the range [__first,__middle) such that i precedes j and k is an iterator in the range [__middle,__last) then *j<*i and *k<*i are both false.

Sort the smallest elements of a sequence using a predicate for comparison.

Parameters
__firstAn iterator.
__middleAnother iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Sorts the smallest (__middle-__first) elements in the range [__first,__last) and moves them to the range [__first,__middle). The order of the remaining elements in the range [__middle,__last) is undefined. After the sort if i and j are iterators in the range [__first,__middle) such that i precedes j and k is an iterator in the range [__middle,__last) then *__comp(j,*i) and __comp(*k,*i) are both false.

Sort a sequence just enough to find a particular position.

Parameters
__firstAn iterator.
__nthAnother iterator.
__lastAnother iterator.
Returns
Nothing.

Rearranges the elements in the range [__first,__last) so that *__nth is the same element that would have been in that position had the whole sequence been sorted. The elements either side of *__nth are not completely sorted, but for any iterator i in the range [__first,__nth) and any iterator j in the range [__nth,__last) it holds that *j < *i is false.

Sort a sequence just enough to find a particular position using a predicate for comparison.

Parameters
__firstAn iterator.
__nthAnother iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Rearranges the elements in the range [__first,__last) so that *__nth is the same element that would have been in that position had the whole sequence been sorted. The elements either side of *__nth are not completely sorted, but for any iterator i in the range [__first,__nth) and any iterator j in the range [__nth,__last) it holds that __comp(*j,*i) is false.

Sort the elements of a sequence.

Parameters
__firstAn iterator.
__lastAnother iterator.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that for each iterator i in the range [__first,__last-1), *(i+1)<*i is false.

The relative ordering of equivalent elements is not preserved, use stable_sort() if this is needed.

Sort the elements of a sequence using a predicate for comparison.

Parameters
__firstAn iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that __comp(*(i+1),*i) is false for every iterator i in the range [__first,__last-1).

The relative ordering of equivalent elements is not preserved, use stable_sort() if this is needed.

Merges two sorted ranges.

Parameters
__first1An iterator.
__first2Another iterator.
__last1Another iterator.
__last2Another iterator.
__resultAn iterator pointing to the end of the merged range.
Returns
An iterator pointing to the first element not less than val.

Merges the ranges [__first1,__last1) and [__first2,__last2) into the sorted range [__result, __result + (__last1-__first1) + (__last2-__first2)). Both input ranges must be sorted, and the output range must not overlap with either of the input ranges. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

Merges two sorted ranges.

Parameters
__first1An iterator.
__first2Another iterator.
__last1Another iterator.
__last2Another iterator.
__resultAn iterator pointing to the end of the merged range.
__compA functor to use for comparisons.
Returns
An iterator pointing to the first element "not less than" val.

Merges the ranges [__first1,__last1) and [__first2,__last2) into the sorted range [__result, __result + (__last1-__first1) + (__last2-__first2)). Both input ranges must be sorted, and the output range must not overlap with either of the input ranges. The sort is stable, that is, for equivalent elements in the two ranges, elements from the first range will always come before elements from the second.

The comparison function should have the same effects on ordering as the function used for the initial sort.

Sort the elements of a sequence, preserving the relative order of equivalent elements.

Parameters
__firstAn iterator.
__lastAnother iterator.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that for each iterator i in the range [__first,__last-1), *(i+1)<*i is false.

The relative ordering of equivalent elements is preserved, so any two elements x and y in the range [__first,__last) such that x<y is false and y<x is false will have the same relative ordering after calling stable_sort().

Sort the elements of a sequence using a predicate for comparison, preserving the relative order of equivalent elements.

Parameters
__firstAn iterator.
__lastAnother iterator.
__compA comparison functor.
Returns
Nothing.

Sorts the elements in the range [__first,__last) in ascending order, such that for each iterator i in the range [__first,__last-1), __comp(*(i+1),*i) is false.

The relative ordering of equivalent elements is preserved, so any two elements x and y in the range [__first,__last) such that __comp(x,y) is false and __comp(y,x) is false will have the same relative ordering after calling stable_sort().

Return the union of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in each range in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that element is copied and the iterator advanced. If an element is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the union of two sorted ranges using a comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in each range in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to __comp, that element is copied and the iterator advanced. If an equivalent element according to __comp is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the intersection of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in both ranges in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that iterator advances. If an element is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the intersection of two sorted ranges using comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in both ranges in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to __comp, that iterator advances. If an element is contained in both ranges according to __comp, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Return the difference of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in the first range but not the second in order to the output range. Iterators increment for each range. When the current element of the first range is less than the second, that element is copied and the iterator advances. If the current element of the second range is less, the iterator advances, but no element is copied. If an element is contained in both ranges, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the difference of two sorted ranges using comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in the first range but not the second in order to the output range. Iterators increment for each range. When the current element of the first range is less than the second according to __comp, that element is copied and the iterator advances. If the current element of the second range is less, no element is copied and the iterator advances. If an element is contained in both ranges according to __comp, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the symmetric difference of two sorted ranges.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in one range but not the other in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that element is copied and the iterator advances. If an element is contained in both ranges, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the symmetric difference of two sorted ranges using comparison functor.

Parameters
__first1Start of first range.
__last1End of first range.
__first2Start of second range.
__last2End of second range.
__compThe comparison functor.
Returns
End of the output range.

This operation iterates over both ranges, copying elements present in one range but not the other in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to comp, that element is copied and the iterator advances. If an element is contained in both ranges according to __comp, no elements are copied and both ranges advance. The output range may not overlap either input range.

Return the minimum element in a range.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
Iterator referencing the first instance of the smallest value.

Return the minimum element in a range using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compComparison functor.
Returns
Iterator referencing the first instance of the smallest value according to __comp.

Return the maximum element in a range.

Parameters
__firstStart of range.
__lastEnd of range.
Returns
Iterator referencing the first instance of the largest value.

Return the maximum element in a range using comparison functor.

Parameters
__firstStart of range.
__lastEnd of range.
__compComparison functor.
Returns
Iterator referencing the first instance of the largest value according to __comp.

Describes the rounding style for floating-point types.

This is used in the std::numeric_limits class.

Intermediate.

To zero.

To the nearest representable value.

To infinity.

To negative infinity.

Describes the denormalization for floating-point types.

These values represent the presence or absence of a variable number of exponent bits. This type is used in the std::numeric_limits class.

Indeterminate at compile time whether denormalized values are allowed.

The type does not allow denormalized values.

The type allows denormalized values.

Part of std::numeric_limits.

The static const members are usable as integral constant expressions.

Note
This is a separate class for purposes of efficiency; you should only access these members as part of an instantiation of the std::numeric_limits class.

This will be true for all fundamental types (which have specializations), and false for everything else.

The number of radix digits that be represented without change: for integer types, the number of non-sign bits in the mantissa; for floating types, the number of radix digits in the mantissa.

The number of base 10 digits that can be represented without change.

True if the type is signed.

True if the type is integer.

True if the type uses an exact representation. All integer types are exact, but not all exact types are integer. For example, rational and fixed-exponent representations are exact but not integer.

For integer types, specifies the base of the representation. For floating types, specifies the base of the exponent representation.

The minimum negative integer such that radix raised to the power of (one less than that integer) is a normalized floating point number.

The minimum negative integer such that 10 raised to that power is in the range of normalized floating point numbers.

The maximum positive integer such that radix raised to the power of (one less than that integer) is a representable finite floating point number.

The maximum positive integer such that 10 raised to that power is in the range of representable finite floating point numbers.

True if the type has a representation for positive infinity.

True if the type has a representation for a quiet (non-signaling) Not a Number.

True if the type has a representation for a signaling Not a Number.

See std::float_denorm_style for more information.

True if loss of accuracy is detected as a denormalization loss, rather than as an inexact result.

True if-and-only-if the type adheres to the IEC 559 standard, also known as IEEE 754. (Only makes sense for floating point types.)

True if the set of values representable by the type is finite. All built-in types are bounded, this member would be false for arbitrary precision types.

True if the type is modulo. A type is modulo if, for any operation involving +, -, or * on values of that type whose result would fall outside the range [min(),max()], the value returned differs from the true value by an integer multiple of max() - min() + 1. On most machines, this is false for floating types, true for unsigned integers, and true for signed integers. See PR22200 about signed integers.

True if trapping is implemented for this type.

True if tininess is detected before rounding. (see IEC 559)

See std::float_round_style for more information. This is only meaningful for floating types; integer types will all be round_toward_zero.

Properties of fundamental types.

This class allows a program to obtain information about the representation of a fundamental type on a given platform. For non-fundamental types, the functions will return 0 and the data members will all be false.

_GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are noted, but not incorporated in this documented (yet).

The minimum finite value, or for floating types with denormalization, the minimum positive normalized value.

The maximum finite value.

The machine epsilon: the difference between 1 and the least value greater than 1 that is representable.

The maximum rounding error measurement (see LIA-1).

The representation of positive infinity, if has_infinity.

The representation of a quiet Not a Number, if has_quiet_NaN.

The representation of a signaling Not a Number, if has_signaling_NaN.

The minimum positive denormalized value. For types where has_denorm is false, this is the minimum positive normalized value.

numeric_limits<bool> specialization.

numeric_limits<char> specialization.

numeric_limits<signed char> specialization.

numeric_limits<unsigned char> specialization.

numeric_limits<wchar_t> specialization.

numeric_limits<short> specialization.

numeric_limits<unsigned short> specialization.

numeric_limits<int> specialization.

numeric_limits<unsigned int> specialization.

numeric_limits<long> specialization.

numeric_limits<unsigned long> specialization.

numeric_limits<long long> specialization.

numeric_limits<unsigned long long> specialization.

numeric_limits<float> specialization.

numeric_limits<double> specialization.

numeric_limits<long double> specialization.

Copies the range [first,last) into result.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__resultAn output iterator.
Returns
__result + (__first - __last)

Like copy(), but does not require an initialized output range.

Copies the value x into the range [first,last).

Parameters
__firstAn input iterator.
__lastAn input iterator.
__xThe source value.
Returns
Nothing.

Like fill(), but does not require an initialized output range.

Copies the value x into the range [first,first+n).

Parameters
__firstAn input iterator.
__nThe number of copies to make.
__xThe source value.
Returns
Nothing.

Like fill_n(), but does not require an initialized output range.

This iterator class lets algorithms store their results into uninitialized memory.

A wrapper class to provide auto_ptr with reference semantics. For example, an auto_ptr can be assigned (or constructed from) the result of a function which returns an auto_ptr by value.

All the auto_ptr_ref stuff should happen behind the scenes.

A simple smart pointer providing strict ownership semantics.

The Standard says:

An auto_ptr owns the object it holds a pointer to.  Copying
an auto_ptr copies the pointer and transfers ownership to the
destination.  If more than one auto_ptr owns the same object
at the same time the behavior of the program is undefined.
The uses of auto_ptr include providing temporary
exception-safety for dynamically allocated memory, passing
ownership of dynamically allocated memory to a function, and
returning dynamically allocated memory from a function.  auto_ptr does not meet the CopyConstructible and Assignable
requirements for Standard Library container elements and thus
instantiating a Standard Library container with an auto_ptr results in undefined behavior.

Quoted from [20.4.5]/3.

Good examples of what can and cannot be done with auto_ptr can be found in the libstdc++ testsuite.

_GLIBCXX_RESOLVE_LIB_DEFECTS

  1. auto_ptr<> conversion issues These resolutions have all been incorporated.

The pointed-to type.

An auto_ptr is usually constructed from a raw pointer.

Parameters
__pA pointer (defaults to NULL).

This object now owns the object pointed to by __p.

An auto_ptr can be constructed from another auto_ptr.

Parameters
__aAnother auto_ptr of the same type.

This object now owns the object previously owned by __a, which has given up ownership.

An auto_ptr can be constructed from another auto_ptr.

Parameters
__aAnother auto_ptr of a different but related type.

A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.

This object now owns the object previously owned by __a, which has given up ownership.

auto_ptr assignment operator.

Parameters
__aAnother auto_ptr of the same type.

This object now owns the object previously owned by __a, which has given up ownership. The object that this one used to own and track has been deleted.

auto_ptr assignment operator.

Parameters
__aAnother auto_ptr of a different but related type.

A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.

This object now owns the object previously owned by __a, which has given up ownership. The object that this one used to own and track has been deleted.

When the auto_ptr goes out of scope, the object it owns is deleted. If it no longer owns anything (i.e., get() is NULL), then this has no effect.

The C++ standard says there is supposed to be an empty throw specification here, but omitting it is standard conforming. Its presence can be detected only if _Tp::~_Tp() throws, but this is prohibited. [17.4.3.6]/2

Smart pointer dereferencing.

If this auto_ptr no longer owns anything, then this operation will crash. (For a smart pointer, no longer owns anything is the same as being a null pointer, and you know what happens when you dereference one of those...)

Smart pointer dereferencing.

This returns the pointer itself, which the language then will automatically cause to be dereferenced.

Bypassing the smart pointer.

Returns
The raw pointer being managed.

You can get a copy of the pointer that this object owns, for situations such as passing to a function which only accepts a raw pointer.

Note
This auto_ptr still owns the memory.

Bypassing the smart pointer.

Returns
The raw pointer being managed.

You can get a copy of the pointer that this object owns, for situations such as passing to a function which only accepts a raw pointer.

Note
This auto_ptr no longer owns the memory. When this object goes out of scope, nothing will happen.

Forcibly deletes the managed object.

Parameters
__pA pointer (defaults to NULL).

This object now owns the object pointed to by __p. The previous object has been deleted.

Automatic conversions

These operations convert an auto_ptr into and from an auto_ptr_ref automatically as needed. This allows constructs such as

auto_ptr<Derived> func_returning_auto_ptr(.....);
...
auto_ptr<Base> ptr = func_returning_auto_ptr(.....);

The actual work of input and output (for std::string).

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class associates either or both of its input and output sequences with a sequence of characters, which can be initialized from, or made available as, a std::basic_string. (Paraphrased from [27.7.1]/1.)

For this class, open modes (of type ios_base::openmode) have in set if the input sequence can be read, and out set if the output sequence can be written.

Place to stash in || out || in | out settings for current stringbuf.

Starts with an empty string buffer.

Parameters
__modeWhether the buffer can read, or write, or both.

The default constructor initializes the parent class using its own default ctor.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__modeWhether the buffer can read, or write, or both.

This constructor initializes the parent class using its own default ctor.

Copying out the string buffer.

Returns
A copy of one of the underlying sequences.

If the buffer is only created in input mode, the underlying character sequence is equal to the input sequence; otherwise, it is equal to the output sequence. [27.7.1.2]/1

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Deallocates any previous stored sequence, then copies s to use as a new one.

Manipulates the buffer.

Parameters
__sPointer to a buffer area.
__nSize of __s.
Returns
this

If no buffer has already been created, and both __s and __n are non-zero, then __s is used as a buffer; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering for more.

Controlling input for std::string.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class supports reading from objects of type std::basic_string, using the inherited functions from std::basic_istream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.

Default constructor starts with an empty string buffer.

Parameters
__modeWhether the buffer can read, or write, or both.

ios_base::in is automatically included in __mode.

Initializes sb using __mode|in, and passes &sb to the base class initializer. Does not allocate any buffer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__modeWhether the buffer can read, or write, or both.

ios_base::in is automatically included in mode.

Initializes sb using str and mode|in, and passes &sb to the base class initializer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

The destructor does nothing.

The buffer is deallocated by the stringbuf object, not the formatting stream.

Accessing the underlying buffer.

Returns
The current basic_stringbuf buffer.

This hides both signatures of std::basic_ios::rdbuf().

Copying out the string buffer.

Returns
rdbuf()->str()

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Calls rdbuf()->str(s).

Controlling output for std::string.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class supports writing to objects of type std::basic_string, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.

Default constructor starts with an empty string buffer.

Parameters
__modeWhether the buffer can read, or write, or both.

ios_base::out is automatically included in mode.

Initializes sb using mode|out, and passes &sb to the base class initializer. Does not allocate any buffer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__modeWhether the buffer can read, or write, or both.

ios_base::out is automatically included in mode.

Initializes sb using str and mode|out, and passes &sb to the base class initializer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

The destructor does nothing.

The buffer is deallocated by the stringbuf object, not the formatting stream.

Accessing the underlying buffer.

Returns
The current basic_stringbuf buffer.

This hides both signatures of std::basic_ios::rdbuf().

Copying out the string buffer.

Returns
rdbuf()->str()

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Calls rdbuf()->str(s).

Controlling input and output for std::string.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.
_AllocAllocator type, defaults to allocator<_CharT>.

This class supports reading from and writing to objects of type std::basic_string, using the inherited functions from std::basic_iostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.

Default constructor starts with an empty string buffer.

Parameters
__mWhether the buffer can read, or write, or both.

Initializes sb using the mode from __m, and passes &sb to the base class initializer. Does not allocate any buffer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

Starts with an existing string buffer.

Parameters
__strA string to copy as a starting buffer.
__mWhether the buffer can read, or write, or both.

Initializes sb using __str and __m, and passes &sb to the base class initializer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.

The destructor does nothing.

The buffer is deallocated by the stringbuf object, not the formatting stream.

Accessing the underlying buffer.

Returns
The current basic_stringbuf buffer.

This hides both signatures of std::basic_ios::rdbuf().

Copying out the string buffer.

Returns
rdbuf()->str()

Setting a new buffer.

Parameters
__sThe string to use as a new sequence.

Calls rdbuf()->str(s).

See bits/stl_deque.h's _Deque_base for an explanation.

A standard container which offers fixed time access to individual elements in any order.

Template Parameters
_TpType of element.
_AllocAllocator type, defaults to allocator<_Tp>.

Meets the requirements of a container, a reversible container, and a sequence, including the optional sequence requirements with the exception of push_front and pop_front.

In some terminology a vector can be described as a dynamic C-style array, it offers fast and efficient access to individual elements in any order and saves the user from worrying about memory and size allocation. Subscripting ( [] ) access is also provided as with C-style arrays.

Creates a vector with no elements.

Creates a vector with no elements.

Parameters
__aAn allocator object.

Creates a vector with copies of an exemplar element.

Parameters
__nThe number of elements to initially create.
__valueAn element to copy.
__aAn allocator.

This constructor fills the vector with __n copies of __value.

Vector copy constructor.

Parameters
__xA vector of identical element and allocator types.

The newly-created vector uses a copy of the allocation object used by __x. All the elements of __x are copied, but any extra memory in __x (for fast expansion) will not be copied.

Builds a vector from a range.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__aAn allocator.

Create a vector consisting of copies of the elements from [first,last).

If the iterators are forward, bidirectional, or random-access, then this will call the elements' copy constructor N times (where N is distance(first,last)) and do no memory reallocation. But if only input iterators are used, then this will do at most 2N calls to the copy constructor, and logN memory reallocations.

The dtor only erases the elements, and note that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Vector assignment operator.

Parameters
__xA vector of identical element and allocator types.

All the elements of __x are copied, but any extra memory in __x (for fast expansion) will not be copied. Unlike the copy constructor, the allocator object is not copied.

Assigns a given value to a vector.

Parameters
__nNumber of elements to be assigned.
__valValue to be assigned.

This function fills a vector with __n copies of the given value. Note that the assignment completely changes the vector and that the resulting vector's size is the same as the number of elements assigned. Old data may be lost.

Assigns a range to a vector.

Parameters
__firstAn input iterator.
__lastAn input iterator.

This function fills a vector with copies of the elements in the range [__first,__last).

Note that the assignment completely changes the vector and that the resulting vector's size is the same as the number of elements assigned. Old data may be lost.

Get a copy of the memory allocation object.

Returns a read/write iterator that points to the first element in the vector. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points to the first element in the vector. Iteration is done in ordinary element order.

Returns a read/write iterator that points one past the last element in the vector. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points one past the last element in the vector. Iteration is done in ordinary element order.

Returns a read/write reverse iterator that points to the last element in the vector. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to the last element in the vector. Iteration is done in reverse element order.

Returns a read/write reverse iterator that points to one before the first element in the vector. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to one before the first element in the vector. Iteration is done in reverse element order.

Returns the number of elements in the vector.

Returns the size() of the largest possible vector.

Resizes the vector to the specified number of elements.

Parameters
__new_sizeNumber of elements the vector should contain.
__xData with which new elements should be populated.

This function will resize the vector to the specified number of elements. If the number is smaller than the vector's current size the vector is truncated, otherwise the vector is extended and new elements are populated with given data.

Returns the total number of elements that the vector can hold before needing to allocate more memory.

Returns true if the vector is empty. (Thus begin() would equal end().)

Attempt to preallocate enough memory for specified number of elements.

Parameters
__nNumber of elements required.
Exceptions
std::length_errorIf n exceeds max_size().

This function attempts to reserve enough memory for the vector to hold the specified number of elements. If the number requested is more than max_size(), length_error is thrown.

The advantage of this function is that if optimal code is a necessity and the user can determine the number of elements that will be required, the user can reserve the memory in advance, and thus prevent a possible reallocation of memory and copying of vector data.

Subscript access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read/write reference to data.

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)

Subscript access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined. (For checked lookups see at().)

Safety check used only from at().

Provides access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read/write reference to data.
Exceptions
std::out_of_rangeIf __n is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the vector. The function throws out_of_range if the check fails.

Provides access to the data contained in the vector.

Parameters
__nThe index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
Exceptions
std::out_of_rangeIf __n is an invalid index.

This function provides for safer data access. The parameter is first checked that it is in the range of the vector. The function throws out_of_range if the check fails.

Returns a read/write reference to the data at the first element of the vector.

Returns a read-only (constant) reference to the data at the first element of the vector.

Returns a read/write reference to the data at the last element of the vector.

Returns a read-only (constant) reference to the data at the last element of the vector.

Returns a pointer such that [data(), data() + size()) is a valid range. For a non-empty vector, data() == &front().

Add data to the end of the vector.

Parameters
__xData to be added.

This is a typical stack operation. The function creates an element at the end of the vector and assigns the given data to it. Due to the nature of a vector this operation can be done in constant time if the vector has preallocated space available.

Removes last element.

This is a typical stack operation. It shrinks the vector by one.

Note that no data is returned, and if the last element's data is needed, it should be retrieved before pop_back() is called.

Inserts given value into vector before specified iterator.

Parameters
__positionAn iterator into the vector.
__xData to be inserted.
Returns
An iterator that points to the inserted data.

This function will insert a copy of the given value before the specified location. Note that this kind of operation could be expensive for a vector and if it is frequently used the user should consider using std::list.

Inserts a number of copies of given data into the vector.

Parameters
__positionAn iterator into the vector.
__nNumber of elements to be inserted.
__xData to be inserted.

This function will insert a specified number of copies of the given data before the location specified by position.

Note that this kind of operation could be expensive for a vector and if it is frequently used the user should consider using std::list.

Inserts a range into the vector.

Parameters
__positionAn iterator into the vector.
__firstAn input iterator.
__lastAn input iterator.

This function will insert copies of the data in the range [__first,__last) into the vector before the location specified by pos.

Note that this kind of operation could be expensive for a vector and if it is frequently used the user should consider using std::list.

Remove element at given position.

Parameters
__positionIterator pointing to element to be erased.
Returns
An iterator pointing to the next element (or end()).

This function will erase the element at the given position and thus shorten the vector by one.

Note This operation could be expensive and if it is frequently used the user should consider using std::list. The user is also cautioned that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove a range of elements.

Parameters
__firstIterator pointing to the first element to be erased.
__lastIterator pointing to one past the last element to be erased.
Returns
An iterator pointing to the element pointed to by __last prior to erasing (or end()).

This function will erase the elements in the range [__first,__last) and shorten the vector accordingly.

Note This operation could be expensive and if it is frequently used the user should consider using std::list. The user is also cautioned that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Swaps data with another vector.

Parameters
__xA vector of the same element and allocator types.

This exchanges the elements between two vectors in constant time. (Three pointers, so it should be quite fast.) Note that the global std::swap() function is specialized such that std::swap(v1,v2) will feed to this function.

Erases all the elements. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Memory expansion handler. Uses the member allocation function to obtain n bytes of memory, and then copies [first,last) into it.

Vector equality comparison.

Parameters
__xA vector.
__yA vector of the same type as __x.
Returns
True iff the size and elements of the vectors are equal.

This is an equivalence relation. It is linear in the size of the vectors. Vectors are considered equivalent if their sizes are equal, and if corresponding elements compare equal.

Vector ordering relation.

Parameters
__xA vector.
__yA vector of the same type as __x.
Returns
True iff __x is lexicographically less than __y.

This is a total ordering relation. It is linear in the size of the vectors. The elements must be comparable with <.

See std::lexicographical_compare() for how the determination is made.

Based on operator==

Based on operator<

Based on operator<

Based on operator<

See std::vector::swap().

A specialization of vector for booleans which offers fixed time access to individual elements in any order.

Template Parameters
_AllocAllocator type.

Note that vector<bool> does not actually meet the requirements for being a container. This is because the reference and pointer types are not really references and pointers to bool. See DR96 for details.

See also
vector for function documentation.

In some terminology a vector can be described as a dynamic C-style array, it offers fast and efficient access to individual elements in any order and saves the user from worrying about memory and size allocation. Subscripting ( [] ) access is also provided as with C-style arrays.

Common part of a node in the list.

An actual node in the list.

A list::iterator.

All the functions are op overloads.

A list::const_iterator.

All the functions are op overloads.

See bits/stl_deque.h's _Deque_base for an explanation.

A standard container with linear time access to elements, and fixed time insertion/deletion at any point in the sequence.

Template Parameters
_TpType of element.
_AllocAllocator type, defaults to allocator<_Tp>.

Meets the requirements of a container, a reversible container, and a sequence, including the optional sequence requirements with the exception of at and operator[].

This is a doubly linked list. Traversal up and down the list requires linear time, but adding and removing elements (or nodes) is done in constant time, regardless of where the change takes place. Unlike std::vector and std::deque, random-access iterators are not provided, so subscripting ( [] ) access is not allowed. For algorithms which only need sequential access, this lack makes no difference.

Also unlike the other standard containers, std::list provides specialized algorithms unique to linked lists, such as splicing, sorting, and in-place reversal.

A couple points on memory allocation for list<Tp>:

First, we never actually allocate a Tp, we allocate List_node<Tp>'s and trust [20.1.5]/4 to DTRT. This is to ensure that after elements from list<X,Alloc1> are spliced into list<X,Alloc2>, destroying the memory of the second list is a valid operation, i.e., Alloc1 giveth and Alloc2 taketh away.

Second, a list conceptually represented as

A <---> B <---> C <---> D

is actually circular; a link exists between A and D. The list class holds (as its only data member) a private list::iterator pointing to D, not to A! To get to the head of the list, we start at the tail and move forward by one. When this member iterator's next/previous pointers refer to itself, the list is empty.

Parameters
__argsAn instance of user data.

Allocates space for a new node and constructs a copy of __args in it.

Creates a list with no elements.

Creates a list with no elements.

Parameters
__aAn allocator object.

Creates a list with copies of an exemplar element.

Parameters
__nThe number of elements to initially create.
__valueAn element to copy.
__aAn allocator object.

This constructor fills the list with __n copies of __value.

List copy constructor.

Parameters
__xA list of identical element and allocator types.

The newly-created list uses a copy of the allocation object used by __x.

Builds a list from a range.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__aAn allocator object.

Create a list consisting of copies of the elements from [__first,__last). This is linear in N (where N is distance(__first,__last)).

No explicit dtor needed as the _Base dtor takes care of things. The _Base dtor only erases the elements, and note that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

List assignment operator.

Parameters
__xA list of identical element and allocator types.

All the elements of __x are copied, but unlike the copy constructor, the allocator object is not copied.

Assigns a given value to a list.

Parameters
__nNumber of elements to be assigned.
__valValue to be assigned.

This function fills a list with __n copies of the given value. Note that the assignment completely changes the list and that the resulting list's size is the same as the number of elements assigned. Old data may be lost.

Assigns a range to a list.

Parameters
__firstAn input iterator.
__lastAn input iterator.

This function fills a list with copies of the elements in the range [__first,__last).

Note that the assignment completely changes the list and that the resulting list's size is the same as the number of elements assigned. Old data may be lost.

Get a copy of the memory allocation object.

Returns a read/write iterator that points to the first element in the list. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points to the first element in the list. Iteration is done in ordinary element order.

Returns a read/write iterator that points one past the last element in the list. Iteration is done in ordinary element order.

Returns a read-only (constant) iterator that points one past the last element in the list. Iteration is done in ordinary element order.

Returns a read/write reverse iterator that points to the last element in the list. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to the last element in the list. Iteration is done in reverse element order.

Returns a read/write reverse iterator that points to one before the first element in the list. Iteration is done in reverse element order.

Returns a read-only (constant) reverse iterator that points to one before the first element in the list. Iteration is done in reverse element order.

Returns true if the list is empty. (Thus begin() would equal end().)

Returns the number of elements in the list.

Returns the size() of the largest possible list.

Resizes the list to the specified number of elements.

Parameters
__new_sizeNumber of elements the list should contain.
__xData with which new elements should be populated.

This function will resize the list to the specified number of elements. If the number is smaller than the list's current size the list is truncated, otherwise the list is extended and new elements are populated with given data.

Returns a read/write reference to the data at the first element of the list.

Returns a read-only (constant) reference to the data at the first element of the list.

Returns a read/write reference to the data at the last element of the list.

Returns a read-only (constant) reference to the data at the last element of the list.

Add data to the front of the list.

Parameters
__xData to be added.

This is a typical stack operation. The function creates an element at the front of the list and assigns the given data to it. Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references.

Removes first element.

This is a typical stack operation. It shrinks the list by one. Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed.

Note that no data is returned, and if the first element's data is needed, it should be retrieved before pop_front() is called.

Add data to the end of the list.

Parameters
__xData to be added.

This is a typical stack operation. The function creates an element at the end of the list and assigns the given data to it. Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references.

Removes last element.

This is a typical stack operation. It shrinks the list by one. Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed.

Note that no data is returned, and if the last element's data is needed, it should be retrieved before pop_back() is called.

Inserts given value into list before specified iterator.

Parameters
__positionAn iterator into the list.
__xData to be inserted.
Returns
An iterator that points to the inserted data.

This function will insert a copy of the given value before the specified location. Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references.

Inserts a number of copies of given data into the list.

Parameters
__positionAn iterator into the list.
__nNumber of elements to be inserted.
__xData to be inserted.

This function will insert a specified number of copies of the given data before the location specified by position.

This operation is linear in the number of elements inserted and does not invalidate iterators and references.

Inserts a range into the list.

Parameters
__positionAn iterator into the list.
__firstAn input iterator.
__lastAn input iterator.

This function will insert copies of the data in the range [first,last) into the list before the location specified by position.

This operation is linear in the number of elements inserted and does not invalidate iterators and references.

Remove element at given position.

Parameters
__positionIterator pointing to element to be erased.
Returns
An iterator pointing to the next element (or end()).

This function will erase the element at the given position and thus shorten the list by one.

Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed. The user is also cautioned that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove a range of elements.

Parameters
__firstIterator pointing to the first element to be erased.
__lastIterator pointing to one past the last element to be erased.
Returns
An iterator pointing to the element pointed to by last prior to erasing (or end()).

This function will erase the elements in the range [first,last) and shorten the list accordingly.

This operation is linear time in the size of the range and only invalidates iterators/references to the element being removed. The user is also cautioned that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Swaps data with another list.

Parameters
__xA list of the same element and allocator types.

This exchanges the elements between two lists in constant time. Note that the global std::swap() function is specialized such that std::swap(l1,l2) will feed to this function.

Erases all the elements. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Insert contents of another list.

Parameters
__positionIterator referencing the element to insert before.
__xSource list.

The elements of __x are inserted in constant time in front of the element referenced by __position. __x becomes an empty list.

Requires this != __x.

Insert element from another list.

Parameters
__positionIterator referencing the element to insert before.
__xSource list.
__iIterator referencing the element to move.

Removes the element in list __x referenced by __i and inserts it into the current list before __position.

Insert range from another list.

Parameters
__positionIterator referencing the element to insert before.
__xSource list.
__firstIterator referencing the start of range in x.
__lastIterator referencing the end of range in x.

Removes elements in the range [__first,__last) and inserts them before __position in constant time.

Undefined if __position is in [__first,__last).

Remove all elements equal to value.

Parameters
__valueThe value to remove.

Removes every element in the list equal to value. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove all elements satisfying a predicate.

Template Parameters
_PredicateUnary predicate function or object.

Removes every element in the list for which the predicate returns true. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove consecutive duplicate elements.

For each consecutive set of elements with the same value, remove all but the first one. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Remove consecutive elements satisfying a predicate.

Template Parameters
_BinaryPredicateBinary predicate function or object.

For each consecutive set of elements [first,last) that satisfy predicate(first,i) where i is an iterator in [first,last), remove all but the first one. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Merge sorted lists.

Parameters
__xSorted list to merge.

Assumes that both __x and this list are sorted according to operator<(). Merges elements of __x into this list in sorted order, leaving __x empty when complete. Elements in this list precede elements in __x that are equal.

Merge sorted lists according to comparison function.

Template Parameters
_StrictWeakOrderingComparison function defining sort order.
Parameters
__xSorted list to merge.
__compComparison functor.

Assumes that both __x and this list are sorted according to StrictWeakOrdering. Merges elements of __x into this list in sorted order, leaving __x empty when complete. Elements in this list precede elements in __x that are equivalent according to StrictWeakOrdering().

Reverse the elements in list.

Reverse the order of elements in the list in linear time.

Sort the elements.

Sorts the elements of this list in NlogN time. Equivalent elements remain in list order.

Sort the elements according to comparison function.

Sorts the elements of this list in NlogN time. Equivalent elements remain in list order.

List equality comparison.

Parameters
__xA list.
__yA list of the same type as __x.
Returns
True iff the size and elements of the lists are equal.

This is an equivalence relation. It is linear in the size of the lists. Lists are considered equivalent if their sizes are equal, and if corresponding elements compare equal.

List ordering relation.

Parameters
__xA list.
__yA list of the same type as __x.
Returns
True iff __x is lexicographically less than __y.

This is a total ordering relation. It is linear in the size of the lists. The elements must be comparable with <.

See std::lexicographical_compare() for how the determination is made.

Based on operator==

Based on operator<

Based on operator<

Based on operator<

See std::list::swap().

Definition at line 68 of file asirfilter.h.