Bayesian Filtering Library
Generated from SVN r
|
Modules | |
Function Objects | |
Memory | |
Unformatted Output Functions | |
namespace std | _GLIBCXX_VISIBILITY (default) |
Components deemed generally useful. Includes pair, tuple, forward/move helpers, ratio, function object, metaprogramming and type traits, time, date, and memory functions.
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.
StateT | Type 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.
__first | An input iterator. |
__last | An input iterator. |
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.
__i | An input iterator. |
__n | The delta by which to change __i . |
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.
__a | An iterator. |
__b | Another iterator. |
This function swaps the values pointed to by two iterators, not the iterators themselves.
Swap the elements of two sequences.
__first1 | A forward iterator. |
__last1 | A forward iterator. |
__first2 | A forward iterator. |
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.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
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.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
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.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
__comp | A comparison functor. |
This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.
This does what you think it does.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
__comp | A comparison functor. |
This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.
Copies the range [first,last) into result.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
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.
__first | A bidirectional iterator. |
__last | A bidirectional iterator. |
__result | A bidirectional iterator. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__value | A reference-to-const of arbitrary type. |
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.
__first | An output iterator. |
__n | The count of copies to perform. |
__value | A reference-to-const of arbitrary type. |
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.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
This is a helper function for the sort routines and for random.tcc.
Tests a range for element-wise equality.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__binary_pred | A binary predicate functor. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__last2 | An input iterator. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__last2 | An input iterator. |
__comp | A comparison functor. |
The same as the four-parameter lexicographical_compare
, but uses the comp parameter instead of <
.
Finds the places in ranges which don't match.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__binary_pred | A binary predicate functor. |
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.
Base class used to implement std::char_traits.
See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt05ch13s03.html 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.
See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt05ch13s03.html 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.
_Tp | Type of allocated object. |
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.
__other | The locale to copy. |
Named locale constructor.
Constructs a copy of the named C library locale.
__s | Name of the locale to construct. |
std::runtime_error | if __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.
__base | The locale to copy. |
__s | Name of the locale to use facets from. |
__cat | Set of categories defining the facets to use from __s. |
std::runtime_error | if __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.
__base | The locale to copy. |
__add | The locale to use facets from. |
__cat | Set 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.
__other | The locale to copy. |
__f | The facet to add in. |
Locale destructor.
Assignment operator.
Set this locale to be a copy of other.
__other | The locale to copy. |
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.
_Facet | The facet type to copy from other |
__other | The locale to copy from. |
std::runtime_error | if __other has no facet of type _Facet. |
Return locale name.
Locale equality.
__other | The locale to compare against. |
Locale inequality.
__other | The locale to compare against. |
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:
__s1 | First string to compare. |
__s2 | Second string to compare. |
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()).
__loc | The new locale to make global. |
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.
__refs | The 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.
__refs | Passed 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.
__cloc | The C locale. |
__refs | Passed to the base facet class. |
Compare two strings.
This function compares two strings and returns the result by calling collate::do_compare().
__lo1 | Start of string 1. |
__hi1 | End of string 1. |
__lo2 | Start of string 2. |
__hi2 | End of string 2. |
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().
__lo | Start of string. |
__hi | End of string. |
Return hash of a string.
This function computes and returns a hash on the input string. It does so by returning collate::do_hash().
__lo | Start of string. |
__hi | End of string. |
Destructor.
Compare two strings.
This function is a hook for derived classes to change the value returned.
__lo1 | Start of string 1. |
__hi1 | End of string 1. |
__lo2 | Start of string 2. |
__hi2 | End of string 2. |
Transform string to comparable form.
This function is a hook for derived classes to change the value returned.
__lo | Start. |
__hi | End. |
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.
__lo | Start of string. |
__hi | End of string. |
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.
_Facet | The facet type to test the presence of. |
__loc | The locale to test. |
__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.
_Facet | The facet type to access. |
__loc | The locale to use. |
std::bad_cast | if __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:
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:
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:
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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch27s02.html
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:
SEEK_CUR
in the C standard library.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.
__e | One of the members of the event enum. |
__b | Reference to the ios_base object. |
__i | The 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.
__fn | The function to add. |
__index | The 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.
Setting new format flags all at once.
__fmtfl | The new flags to set. |
This function overwrites all the format flags with __fmtfl.
Setting new format flags.
__fmtfl | Additional flags to set. |
This function sets additional flags in format control. Flags that were previously set remain set.
Setting new format flags.
__fmtfl | Additional flags to set. |
__mask | The flags mask for fmtfl. |
This function clears mask in the format flags, then sets fmtfl &
mask. An example mask is ios_base::adjustfield
.
Clearing format flags.
__mask | The flags to unset. |
This function clears __mask in the format flags.
Flags access.
Be careful if you try to give a definition of precision here; see DR 189.
Changing flags.
__prec | The new precision value. |
Flags access.
Minimum field width refers to the number of characters.
Changing flags.
__wide | The new width value. |
Interaction with the standard C I/O objects.
__sync | Whether to synchronize or not. |
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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch28s02.html
Setting a new locale.
__loc | The new locale. |
Sets the new locale for this stream, and then invokes each callback with imbue_event.
Locale access
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
Like getloc above, but returns a reference instead of generating a copy.
Access to unique indices.
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.
__ix | Index into the array. |
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.
__ix | Index into the array. |
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).
_CharT | Type of character stream. |
_Traits | Traits 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.
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:charT
array, as described above; otherwise, xbeg and xend shall also be null.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().
__loc | The new locale. |
Calls the derived imbue(__loc).
Locale access.
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.
__off | Offset. |
__way | Value for ios_base::seekdir. |
__mode | Value for ios_base::openmode. |
Calls virtual seekoff function.
Alters the stream position.
__sp | Position |
__mode | Value for ios_base::openmode. |
Calls virtual seekpos function.
Calls virtual sync function.
Looking ahead into the stream.
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.
Calls sbumpc()
, and if that function returns traits::eof()
, so does this function. Otherwise, sgetc()
.
Getting the next character.
If the input read position is available, returns that character and increments the read pointer, otherwise calls and returns uflow()
.
Getting the next character.
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.
__s | A buffer area. |
__n | A 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.
__c | The character to push back. |
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.
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.
__c | A character to output. |
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.
__s | A buffer read area. |
__n | A 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,
Access to the get area.
These functions are only available to other protected functions, including derived classes.
Moving the read position.
__n | The delta by which to move. |
This just advances the read position without returning any data.
Setting the three read area pointers.
__gbeg | A pointer. |
__gnext | A pointer. |
__gend | A pointer. |
eback()
, __gnext == gptr()
, and __gend == egptr()
Access to the put area.
These functions are only available to other protected functions, including derived classes.
Moving the write position.
__n | The delta by which to move. |
This just advances the write position without returning any data.
Setting the three write area pointers.
__pbeg | A pointer. |
__pend | A pointer. |
pbase()
, __pbeg == pptr()
, and __pend == epptr()
Changes translations.
__loc | A 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.
Manipulates the buffer.
Each derived class provides its own appropriate behavior. See the next-to-last paragraph of http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html for more on this function.
this
.Alters the stream positions.
Each derived class provides its own appropriate behavior.
pos_type
that represents an invalid stream position.Alters the stream positions.
Each derived class provides its own appropriate behavior.
pos_type
that represents an invalid stream position.Synchronizes the buffer arrays with the controlled sequences.
Each derived class provides its own appropriate behavior, including the definition of failure.
Investigating the data available.
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
eof()
but that they will return immediately. showmanyc
are es-how-many-see, not show-manic.Multiple character extraction.
__s | A buffer area. |
__n | Maximum number of characters to assign. |
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.
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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25.html
Fetches more data from the controlled 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.
__c | The character to be inserted back into the sequence. |
gptr()
, eback()
, and pptr()
are the same as for underflow()
.Multiple character insertion.
__s | A buffer area. |
__n | Maximum number of characters to write. |
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.
__c | An additional character to consume. |
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).
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().
__c | The char_type to compare the mask of. |
__m | The mask to compare against. |
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().
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__vec | Pointer to an array of mask storage. |
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().
__m | The mask to compare against. |
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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().
__m | The mask to compare against. |
__lo | Pointer to first char in range. |
__hi | Pointer to end of range. |
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().
__c | The char_type to convert. |
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).
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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).
__c | The char_type to convert. |
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).
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__to | Pointer to the destination array. |
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.
__c | The char_type to convert. |
__dfault | Char to return if conversion fails. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__dfault | Char to use if conversion fails. |
__to | Pointer to the destination array. |
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.
__c | The char_type to find the mask of. |
__m | The mask to compare against. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__vec | Pointer to an array of mask storage. |
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.
__m | The mask to compare against. |
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__m | The mask to compare against. |
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The char_type to convert. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The char_type to convert. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to start range. |
__hi | Pointer to end of range. |
__to | Pointer to the destination array. |
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.
__c | The char_type to convert. |
__dfault | Char to return if conversion fails. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__dfault | Char to use if conversion fails. |
__to | Pointer to the destination array. |
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.
__table | If non-zero, table is used as the per-char mask. Else classic_table() is used. |
__del | If true, passes ownership of table to this facet. |
__refs | Passed to the base facet class. |
Constructor performs static initialization.
This constructor is used to construct the initial C locale facet.
__cloc | Handle to C locale data. |
__table | If non-zero, table is used as the per-char mask. |
__del | If true, passes ownership of table to this facet. |
__refs | Passed to the base facet class. |
Test char classification.
This function compares the mask table[c] to __m.
__c | The char to compare the mask of. |
__m | The mask to compare against. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__vec | Pointer to an array of mask storage. |
Find char matching a mask
This function searches for and returns the first char in [lo,hi) for which is(m,char) is true.
__m | The mask to compare against. |
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__m | The mask to compare against. |
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to first char in range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to first char in range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to first char in range. |
__hi | Pointer to end of range. |
__to | Pointer to the destination array. |
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.
__c | The char to convert. |
__dfault | Char to return if conversion fails. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__dfault | Char to use if conversion fails. |
__to | Pointer to the destination array. |
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.
__c | The char to convert. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to first char in range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__to | Pointer to the destination array. |
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.
__c | The char to convert. |
__dfault | Char to return if conversion fails. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__dfault | Char to use if conversion fails. |
__to | Pointer to the destination array. |
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.
__refs | Passed to the base facet class. |
Constructor performs static initialization.
This constructor is used to construct the initial C locale facet.
__cloc | Handle to C locale data. |
__refs | Passed 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.
__c | The wchar_t to find the mask of. |
__m | The mask to compare against. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__vec | Pointer to an array of mask storage. |
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.
__m | The mask to compare against. |
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__m | The mask to compare against. |
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The wchar_t to convert. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The wchar_t to convert. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
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.
__c | The char to convert. |
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.
__lo | Pointer to start range. |
__hi | Pointer to end of range. |
__to | Pointer to the destination array. |
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.
__c | The wchar_t to convert. |
__dfault | Char to return if conversion fails. |
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.
__lo | Pointer to start of range. |
__hi | Pointer to end of range. |
__dfault | Char to use if conversion fails. |
__to | Pointer to the destination array. |
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.
__refs | Refcount 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.
__cache | __numpunct_cache object. |
__refs | Refcount 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.
__cloc | The C locale. |
__refs | Refcount 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().
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().
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().
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().
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().
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.
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.
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.
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.
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.
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.
__refs | Passed 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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
Destructor.
Numeric parsing.
Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.
__beg | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__refs | Passed 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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
_CharT | Type of character stream. |
_Traits | Traits 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.
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.
__state | The 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.
__state | The additional state flag(s) to set. |
See std::ios_base::iostate for the possible bit values.
Fast error checking.
A wrapper around rdstate.
Fast error checking.
Note that other iostate flags may also be set.
Fast error checking.
Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set.
Fast error checking.
Note that other iostate flags may also be set.
Throwing exceptions on errors.
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.
__except | The 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:
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.
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.
__tiestr | The output stream. |
This sets up a new tie; see tie() for more.
Accessing the underlying buffer.
This does not change the state of the stream.
Changing the underlying buffer.
__sb | The new 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:
Copies fields of __rhs into this.
__rhs | The source values for the copies. |
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.
It defaults to a space (' ') in the current locale.
Sets a new empty character.
__ch | The new 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.
__loc | The new 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.
__c | The character to narrow. |
__dfault | The character to narrow. |
Maps a character of char_type
to a character of char
, if possible.
Returns the result of
Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
Widens characters.
__c | The character to widen. |
Maps a character of char
to a character of char_type
.
Returns the result of
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.
Uniform interface to C++98 and C++0x allocators.
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.
__len | The number of objects of type Tp. |
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().
__p | A buffer previously allocated by get_temporary_buffer. |
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 to *__result
Swaps the median value of *__a, *__b and *__c under __comp to *__result
This is an overload used by find() for the Input Iterator case.
This is an overload used by find_if() for the Input Iterator case.
This is an overload used by find() for the RAI case.
This is an overload used by find_if() for the RAI case.
This is an overload used by find_if_not() for the Input Iterator case.
This is an overload used by find_if_not() 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 uglified search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&) overloaded for forward iterators.
This is an uglified search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&) overloaded for random access iterators.
This is an uglified search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&, _BinaryPredicate) overloaded for forward iterators.
This is an uglified search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&, _BinaryPredicate) overloaded for random access iterators.
Find last matching subsequence in a sequence.
__first1 | Start of range to search. |
__last1 | End of range to search. |
__first2 | Start of sequence to match. |
__last2 | End of sequence to match. |
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 [__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))
Find last matching subsequence in a sequence using a predicate.
__first1 | Start of range to search. |
__last1 | End of range to search. |
__first2 | Start of sequence to match. |
__last2 | End of sequence to match. |
__comp | The predicate to use. |
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.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
__value | The value to be removed. |
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.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
__pred | A predicate. |
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.
__first | An input iterator. |
__last | An input iterator. |
__value | The value to be removed. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__pred | A predicate. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__binary_pred | A binary predicate. |
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) overloaded for forward iterators and output iterator as result.
This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator) overloaded for input iterators and output iterator as result.
This is an uglified unique_copy(_InputIterator, _InputIterator, _OutputIterator) overloaded for input iterators and forward iterator as result.
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.
__first | A bidirectional iterator. |
__last | A bidirectional iterator. |
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.
__first | A bidirectional iterator. |
__last | A bidirectional iterator. |
__result | An output iterator. |
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.
__first | A forward iterator. |
__middle | A forward iterator. |
__last | A forward iterator. |
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.
__first | A forward iterator. |
__middle | A forward iterator. |
__last | A forward iterator. |
__result | An output iterator. |
Copies the elements of the range [__first,__last) to the range beginning at
(__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 __len != 0 and !__pred(*__first), same as __stable_partition_adaptive.
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.
__first | A forward iterator. |
__last | A forward iterator. |
__pred | A predicate functor. |
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.
This is a helper function for the sort routines.
Copy the smallest elements of a sequence.
__first | An iterator. |
__last | Another iterator. |
__result_first | A random-access iterator. |
__result_last | Another random-access iterator. |
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.
__first | An input iterator. |
__last | Another input iterator. |
__result_first | A random-access iterator. |
__result_last | Another random-access iterator. |
__comp | A comparison functor. |
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 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 for the sort routine.
This is a helper function...
This is a helper function...
This is a helper function...
This is a helper function...
This is a helper function for the sort routine.
This is a helper function for the sort routine.
Finds the first position in which __val
could be inserted without changing the ordering.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
__comp | A functor to use for comparisons. |
__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.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
__val
, or end() if no elements are greater than __val
.Finds the last position in which __val
could be inserted without changing the ordering.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
__comp | A functor to use for comparisons. |
__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.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
This is equivalent to
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.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
__comp | A functor to use for comparisons. |
This is equivalent to
but does not actually call those functions.
Determines whether an element exists in a range.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
__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.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
__comp | A functor to use for comparisons. |
__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_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.
This is a helper function for the merge routines.
This is a helper function for the merge routines.
Merges two sorted ranges in place.
__first | An iterator. |
__middle | Another iterator. |
__last | Another iterator. |
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.
__first | An iterator. |
__middle | Another iterator. |
__last | Another iterator. |
__comp | A functor to use for comparisons. |
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 __merge_sort_loop routines.
This is a helper function for the stable sorting routines.
This is a helper function for the stable sorting routines.
Determines whether all elements of a sequence exists in a range.
__first1 | Start of search range. |
__last1 | End of search range. |
__first2 | Start of sequence |
__last2 | End of sequence. |
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.
__first1 | Start of search range. |
__last1 | End of search range. |
__first2 | Start of sequence |
__last2 | End of sequence. |
__comp | Comparison function to use. |
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.
__first | Start of range. |
__last | End of range. |
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.
__first | Start of range. |
__last | End of range. |
__comp | A comparison functor. |
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.
__first | Start of range. |
__last | End of range. |
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.
__first | Start of range. |
__last | End of range. |
__comp | A comparison functor. |
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.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
__old_value | The value to be replaced. |
__new_value | The replacement value. |
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.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
__pred | A predicate. |
__new_value | The replacement value. |
__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.
__first | An input iterator. |
__last | An input iterator. |
__f | A unary function object. |
__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.
__first | An input iterator. |
__last | An input iterator. |
__val | The value to find. |
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.
__first | An input iterator. |
__last | An input iterator. |
__pred | A predicate. |
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.
__first1 | Start of range to search. |
__last1 | End of range to search. |
__first2 | Start of match candidates. |
__last2 | End of match candidates. |
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.
__first1 | Start of range to search. |
__last1 | End of range to search. |
__first2 | Start of match candidates. |
__last2 | End of match candidates. |
__comp | Predicate to use. |
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.
__first | A forward iterator. |
__last | A forward 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.
__first | A forward iterator. |
__last | A forward iterator. |
__binary_pred | A binary predicate. |
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.
__first | An input iterator. |
__last | An input iterator. |
__value | The value to be counted. |
i
in the range
[__first,__last) for which *i
== __value
Count the elements of a sequence for which a predicate is true.
__first | An input iterator. |
__last | An input iterator. |
__pred | A predicate. |
i
in the range
[__first,__last) for which __pred(*i)
is true.Search a sequence for a matching sub-sequence.
__first1 | A forward iterator. |
__last1 | A forward iterator. |
__first2 | A forward iterator. |
__last2 | A forward 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.
__first1 | A forward iterator. |
__last1 | A forward iterator. |
__first2 | A forward iterator. |
__last2 | A forward iterator. |
__predicate | A binary predicate. |
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.
Search a sequence for a number of consecutive values.
__first | A forward iterator. |
__last | A forward iterator. |
__count | The number of consecutive values. |
__val | The value to find. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__count | The number of consecutive values. |
__val | The value to find. |
__binary_pred | A binary predicate. |
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.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
__unary_op | A unary operator. |
__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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__result | An output iterator. |
__binary_op | A binary operator. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__old_value | The value to be replaced. |
__new_value | The replacement 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.
__first | A forward iterator. |
__last | A forward iterator. |
__pred | A predicate. |
__new_value | The replacement 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.
__first | A forward iterator. |
__last | A forward iterator. |
__gen | A function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type |
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.
__first | A forward iterator. |
__n | The length of the sequence. |
__gen | A function object taking no arguments and returning std::iterator_traits<_ForwardIterator>::value_type |
__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.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
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.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
__binary_pred | A binary predicate. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__rand | The RNG functor or function. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__pred | A predicate functor. |
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.
__first | An iterator. |
__middle | Another iterator. |
__last | Another iterator. |
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.
__first | An iterator. |
__middle | Another iterator. |
__last | Another iterator. |
__comp | A comparison functor. |
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.
__first | An iterator. |
__nth | Another iterator. |
__last | Another iterator. |
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.
__first | An iterator. |
__nth | Another iterator. |
__last | Another iterator. |
__comp | A comparison functor. |
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.
__first | An iterator. |
__last | Another iterator. |
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.
__first | An iterator. |
__last | Another iterator. |
__comp | A comparison functor. |
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.
__first1 | An iterator. |
__first2 | Another iterator. |
__last1 | Another iterator. |
__last2 | Another iterator. |
__result | An iterator pointing to the end of the merged range. |
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.
__first1 | An iterator. |
__first2 | Another iterator. |
__last1 | Another iterator. |
__last2 | Another iterator. |
__result | An iterator pointing to the end of the merged range. |
__comp | A functor to use for comparisons. |
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.
__first | An iterator. |
__last | Another iterator. |
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.
__first | An iterator. |
__last | Another iterator. |
__comp | A comparison functor. |
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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second 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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second range. |
__comp | The comparison functor. |
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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second 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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second range. |
__comp | The comparison functor. |
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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second 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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second range. |
__comp | The comparison functor. |
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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second 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.
__first1 | Start of first range. |
__last1 | End of first range. |
__first2 | Start of second range. |
__last2 | End of second range. |
__comp | The comparison functor. |
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.
__first | Start of range. |
__last | End of range. |
Return the minimum element in a range using comparison functor.
__first | Start of range. |
__last | End of range. |
__comp | Comparison functor. |
Return the maximum element in a range.
__first | Start of range. |
__last | End of range. |
Return the maximum element in a range using comparison functor.
__first | Start of range. |
__last | End of range. |
__comp | Comparison functor. |
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.
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<__int128> specialization.
numeric_limits<unsigned __int128> specialization.
numeric_limits<float> specialization.
numeric_limits<double> specialization.
numeric_limits<long double> specialization.
Copies the range [first,last) into result.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
Like copy(), but does not require an initialized output range.
Copies the value x into the range [first,last).
__first | An input iterator. |
__last | An input iterator. |
__x | The source value. |
Like fill(), but does not require an initialized output range.
Copies the value x into the range [first,first+n).
__first | An input iterator. |
__n | The number of copies to make. |
__x | The source value. |
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:
Anauto_ptr
owns the object it holds a pointer to. Copying anauto_ptr
copies the pointer and transfers ownership to the destination. If more than oneauto_ptr
owns the same object at the same time the behavior of the program is undefined.
The uses ofauto_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 anauto_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
The pointed-to type.
An auto_ptr is usually constructed from a raw pointer.
__p | A pointer (defaults to NULL). |
This object now owns the object pointed to by __p.
An auto_ptr can be constructed from another auto_ptr.
__a | Another 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.
__a | Another 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.
__a | Another 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.
__a | Another 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.
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.
Bypassing the smart pointer.
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.
Forcibly deletes the managed object.
__p | A 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
The actual work of input and output (for std::string).
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__mode | Whether 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.
__str | A string to copy as a starting buffer. |
__mode | Whether the buffer can read, or write, or both. |
This constructor initializes the parent class using its own default ctor.
Copying out the string buffer.
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.
__s | The string to use as a new sequence. |
Deallocates any previous stored sequence, then copies s to use as a new one.
Manipulates the buffer.
__s | Pointer to a buffer area. |
__n | Size of __s. |
this
If no buffer has already been created, and both __s and __n are non-zero, then __s
is used as a buffer; see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html for more.
Controlling input for std::string.
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__mode | Whether 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.
__str | A string to copy as a starting buffer. |
__mode | Whether 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.
This hides both signatures of std::basic_ios::rdbuf().
Copying out the string buffer.
rdbuf()->str()
Setting a new buffer.
__s | The string to use as a new sequence. |
Calls rdbuf()->str(s)
.
Controlling output for std::string.
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__mode | Whether 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.
__str | A string to copy as a starting buffer. |
__mode | Whether 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.
This hides both signatures of std::basic_ios::rdbuf().
Copying out the string buffer.
rdbuf()->str()
Setting a new buffer.
__s | The string to use as a new sequence. |
Calls rdbuf()->str(s)
.
Controlling input and output for std::string.
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__m | Whether 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.
__str | A string to copy as a starting buffer. |
__m | Whether 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.
This hides both signatures of std::basic_ios::rdbuf().
Copying out the string buffer.
rdbuf()->str()
Setting a new buffer.
__s | The 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.
_Tp | Type of element. |
_Alloc | Allocator 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.
Default constructor creates no elements.
Creates a vector with no elements.
__a | An allocator object. |
Creates a vector with copies of an exemplar element.
__n | The number of elements to initially create. |
__value | An element to copy. |
__a | An allocator. |
This constructor fills the vector with __n copies of __value.
Vector copy constructor.
__x | A 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.
__first | An input iterator. |
__last | An input iterator. |
__a | An 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.
__x | A 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.
__n | Number of elements to be assigned. |
__val | Value 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.
__first | An input iterator. |
__last | An 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.
__new_size | Number of elements the vector should contain. |
__x | Data 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.
__n | Number of elements required. |
std::length_error | If 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.
__n | The index of the element for which data should be accessed. |
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.
__n | The index of the element for which data should be accessed. |
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.
__n | The index of the element for which data should be accessed. |
std::out_of_range | If __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.
__n | The index of the element for which data should be accessed. |
std::out_of_range | If __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.
__x | Data 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.
__position | An iterator into the vector. |
__x | Data to be inserted. |
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.
__position | An iterator into the vector. |
__n | Number of elements to be inserted. |
__x | Data 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.
__position | An iterator into the vector. |
__first | An input iterator. |
__last | An 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.
__position | Iterator pointing to element to be erased. |
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.
__first | Iterator pointing to the first element to be erased. |
__last | Iterator pointing to one past the last element to be erased. |
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.
__x | A 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.
__x | A vector. |
__y | A vector of the same type as __x. |
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.
__x | A vector. |
__y | A vector of the same type as __x. |
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.
_Alloc | Allocator 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.
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.
< User's data.
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.
_Tp | Type of element. |
_Alloc | Allocator 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
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.
__args | An instance of user data. |
Allocates space for a new node and constructs a copy of __args in it.
Default constructor creates no elements.
Creates a list with no elements.
__a | An allocator object. |
Creates a list with copies of an exemplar element.
__n | The number of elements to initially create. |
__value | An element to copy. |
__a | An allocator object. |
This constructor fills the list with __n copies of __value.
List copy constructor.
__x | A 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.
__first | An input iterator. |
__last | An input iterator. |
__a | An 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.
__x | A 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.
__n | Number of elements to be assigned. |
__val | Value 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.
__first | An input iterator. |
__last | An 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.
__new_size | Number of elements the list should contain. |
__x | Data 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.
__x | Data 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.
__x | Data 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.
__position | An iterator into the list. |
__x | Data to be inserted. |
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.
__position | An iterator into the list. |
__n | Number of elements to be inserted. |
__x | Data 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.
__position | An iterator into the list. |
__first | An input iterator. |
__last | An 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.
__position | Iterator pointing to element to be erased. |
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.
__first | Iterator pointing to the first element to be erased. |
__last | Iterator pointing to one past the last element to be erased. |
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.
__x | A 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.
__position | Iterator referencing the element to insert before. |
__x | Source 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.
__position | Iterator referencing the element to insert before. |
__x | Source list. |
__i | Iterator 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.
__position | Iterator referencing the element to insert before. |
__x | Source list. |
__first | Iterator referencing the start of range in x. |
__last | Iterator 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.
__value | The 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.
_Predicate | Unary 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.
_BinaryPredicate | Binary 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.
__x | Sorted 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.
_StrictWeakOrdering | Comparison function defining sort order. |
__x | Sorted list to merge. |
__comp | Comparison 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.
__x | A list. |
__y | A list of the same type as __x. |
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.
__x | A list. |
__y | A list of the same type as __x. |
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.
__first | An input iterator. |
__last | An input iterator. |
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.
__i | An input iterator. |
__n | The delta by which to change __i . |
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.
__a | An iterator. |
__b | Another iterator. |
This function swaps the values pointed to by two iterators, not the iterators themselves.
Swap the elements of two sequences.
__first1 | A forward iterator. |
__last1 | A forward iterator. |
__first2 | A forward iterator. |
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.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
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.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
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.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
__comp | A comparison functor. |
This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.
This does what you think it does.
__a | A thing of arbitrary type. |
__b | Another thing of arbitrary type. |
__comp | A comparison functor. |
This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.
Copies the range [first,last) into result.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
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.
__first | A bidirectional iterator. |
__last | A bidirectional iterator. |
__result | A bidirectional iterator. |
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.
__first | A forward iterator. |
__last | A forward iterator. |
__value | A reference-to-const of arbitrary type. |
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.
__first | An output iterator. |
__n | The count of copies to perform. |
__value | A reference-to-const of arbitrary type. |
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.
__first | An iterator. |
__last | Another iterator. |
__val | The search term. |
This is a helper function for the sort routines and for random.tcc.
Tests a range for element-wise equality.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__binary_pred | A binary predicate functor. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__last2 | An input iterator. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__last2 | An input iterator. |
__comp | A comparison functor. |
The same as the four-parameter lexicographical_compare
, but uses the comp parameter instead of <
.
Finds the places in ranges which don't match.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
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.
__first1 | An input iterator. |
__last1 | An input iterator. |
__first2 | An input iterator. |
__binary_pred | A binary predicate functor. |
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.
Base class used to implement std::char_traits.
See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt05ch13s03.html 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.
_Tp | Type of allocated object. |
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.
__other | The locale to copy. |
Named locale constructor.
Constructs a copy of the named C library locale.
__s | Name of the locale to construct. |
std::runtime_error | if __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.
__base | The locale to copy. |
__s | Name of the locale to use facets from. |
__cat | Set of categories defining the facets to use from __s. |
std::runtime_error | if __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.
__base | The locale to copy. |
__add | The locale to use facets from. |
__cat | Set 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.
__other | The locale to copy. |
__f | The facet to add in. |
Locale destructor.
Assignment operator.
Set this locale to be a copy of other.
__other | The locale to copy. |
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.
_Facet | The facet type to copy from other |
__other | The locale to copy from. |
std::runtime_error | if __other has no facet of type _Facet. |
Return locale name.
Locale equality.
__other | The locale to compare against. |
Locale inequality.
__other | The locale to compare against. |
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:
__s1 | First string to compare. |
__s2 | Second string to compare. |
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()).
__loc | The new locale to make global. |
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.
__refs | The 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.
__refs | Passed 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.
__cloc | The C locale. |
__refs | Passed to the base facet class. |
Compare two strings.
This function compares two strings and returns the result by calling collate::do_compare().
__lo1 | Start of string 1. |
__hi1 | End of string 1. |
__lo2 | Start of string 2. |
__hi2 | End of string 2. |
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().
__lo | Start of string. |
__hi | End of string. |
Return hash of a string.
This function computes and returns a hash on the input string. It does so by returning collate::do_hash().
__lo | Start of string. |
__hi | End of string. |
Destructor.
Compare two strings.
This function is a hook for derived classes to change the value returned.
__lo1 | Start of string 1. |
__hi1 | End of string 1. |
__lo2 | Start of string 2. |
__hi2 | End of string 2. |
Transform string to comparable form.
This function is a hook for derived classes to change the value returned.
__lo | Start. |
__hi | End. |
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.
__lo | Start of string. |
__hi | End of string. |
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.
_Facet | The facet type to test the presence of. |
__loc | The locale to test. |
__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.
_Facet | The facet type to access. |
__loc | The locale to use. |
std::bad_cast | if __loc doesn't contain a facet of type _Facet. |
The actual work of input and output (interface).
_CharT | Type of character stream. |
_Traits | Traits 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.
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:charT
array, as described above; otherwise, xbeg and xend shall also be null.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().
__loc | The new locale. |
Calls the derived imbue(__loc).
Locale access.
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.
__off | Offset. |
__way | Value for ios_base::seekdir. |
__mode | Value for ios_base::openmode. |
Calls virtual seekoff function.
Alters the stream position.
__sp | Position |
__mode | Value for ios_base::openmode. |
Calls virtual seekpos function.
Calls virtual sync function.
Looking ahead into the stream.
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.
Calls sbumpc()
, and if that function returns traits::eof()
, so does this function. Otherwise, sgetc()
.
Getting the next character.
If the input read position is available, returns that character and increments the read pointer, otherwise calls and returns uflow()
.
Getting the next character.
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.
__s | A buffer area. |
__n | A 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.
__c | The character to push back. |
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.
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.
__c | A character to output. |
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.
__s | A buffer read area. |
__n | A 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,
Access to the get area.
These functions are only available to other protected functions, including derived classes.
Moving the read position.
__n | The delta by which to move. |
This just advances the read position without returning any data.
Setting the three read area pointers.
__gbeg | A pointer. |
__gnext | A pointer. |
__gend | A pointer. |
eback()
, __gnext == gptr()
, and __gend == egptr()
Access to the put area.
These functions are only available to other protected functions, including derived classes.
Moving the write position.
__n | The delta by which to move. |
This just advances the write position without returning any data.
Setting the three write area pointers.
__pbeg | A pointer. |
__pend | A pointer. |
pbase()
, __pbeg == pptr()
, and __pend == epptr()
Changes translations.
__loc | A 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.
Manipulates the buffer.
Each derived class provides its own appropriate behavior. See the next-to-last paragraph of http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html for more on this function.
this
.Alters the stream positions.
Each derived class provides its own appropriate behavior.
pos_type
that represents an invalid stream position.Alters the stream positions.
Each derived class provides its own appropriate behavior.
pos_type
that represents an invalid stream position.Synchronizes the buffer arrays with the controlled sequences.
Each derived class provides its own appropriate behavior, including the definition of failure.
Investigating the data available.
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
eof()
but that they will return immediately. showmanyc
are es-how-many-see, not show-manic.Multiple character extraction.
__s | A buffer area. |
__n | Maximum number of characters to assign. |
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.
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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25.html
Fetches more data from the controlled 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.
__c | The character to be inserted back into the sequence. |
gptr()
, eback()
, and pptr()
are the same as for underflow()
.Multiple character insertion.
__s | A buffer area. |
__n | Maximum number of characters to write. |
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.
__c | An additional character to consume. |
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).
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.
__refs | Refcount 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.
__cache | __numpunct_cache object. |
__refs | Refcount 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.
__cloc | The C locale. |
__refs | Refcount 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().
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().
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().
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().
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().
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.
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.
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.
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.
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.
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.
__refs | Passed 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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__in | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
Destructor.
Numeric parsing.
Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.
__beg | Start of input stream. |
__end | End of input stream. |
__io | Source of locale and flags. |
__err | Error flags to set. |
__v | Value to format and insert. |
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.
__refs | Passed 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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
__s | Stream to write to. |
__io | Source of locale and flags. |
__fill | Char_type to use for filling. |
__v | Value to format and insert. |
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.
_CharT | Type of character stream. |
_Traits | Traits 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.
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.
__state | The 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.
__state | The additional state flag(s) to set. |
See std::ios_base::iostate for the possible bit values.
Fast error checking.
A wrapper around rdstate.
Fast error checking.
Note that other iostate flags may also be set.
Fast error checking.
Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set.
Fast error checking.
Note that other iostate flags may also be set.
Throwing exceptions on errors.
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.
__except | The 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:
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.
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.
__tiestr | The output stream. |
This sets up a new tie; see tie() for more.
Accessing the underlying buffer.
This does not change the state of the stream.
Changing the underlying buffer.
__sb | The new 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:
Copies fields of __rhs into this.
__rhs | The source values for the copies. |
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.
It defaults to a space (' ') in the current locale.
Sets a new empty character.
__ch | The new 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.
__loc | The new 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.
__c | The character to narrow. |
__dfault | The character to narrow. |
Maps a character of char_type
to a character of char
, if possible.
Returns the result of
Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
Widens characters.
__c | The character to widen. |
Maps a character of char
to a character of char_type
.
Returns the result of
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.
Uniform interface to C++98 and C++0x allocators.
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.
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<__int128> specialization.
numeric_limits<unsigned __int128> specialization.
numeric_limits<float> specialization.
numeric_limits<double> specialization.
numeric_limits<long double> specialization.
Copies the range [first,last) into result.
__first | An input iterator. |
__last | An input iterator. |
__result | An output iterator. |
Like copy(), but does not require an initialized output range.
Copies the value x into the range [first,last).
__first | An input iterator. |
__last | An input iterator. |
__x | The source value. |
Like fill(), but does not require an initialized output range.
Copies the value x into the range [first,first+n).
__first | An input iterator. |
__n | The number of copies to make. |
__x | The source value. |
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:
Anauto_ptr
owns the object it holds a pointer to. Copying anauto_ptr
copies the pointer and transfers ownership to the destination. If more than oneauto_ptr
owns the same object at the same time the behavior of the program is undefined.
The uses ofauto_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 anauto_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
The pointed-to type.
An auto_ptr is usually constructed from a raw pointer.
__p | A pointer (defaults to NULL). |
This object now owns the object pointed to by __p.
An auto_ptr can be constructed from another auto_ptr.
__a | Another 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.
__a | Another 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.
__a | Another 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.
__a | Another 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.
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.
Bypassing the smart pointer.
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.
Forcibly deletes the managed object.
__p | A 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
The actual work of input and output (for std::string).
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__mode | Whether 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.
__str | A string to copy as a starting buffer. |
__mode | Whether the buffer can read, or write, or both. |
This constructor initializes the parent class using its own default ctor.
Copying out the string buffer.
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.
__s | The string to use as a new sequence. |
Deallocates any previous stored sequence, then copies s to use as a new one.
Manipulates the buffer.
__s | Pointer to a buffer area. |
__n | Size of __s. |
this
If no buffer has already been created, and both __s and __n are non-zero, then __s
is used as a buffer; see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html for more.
Controlling input for std::string.
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__mode | Whether 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.
__str | A string to copy as a starting buffer. |
__mode | Whether 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.
This hides both signatures of std::basic_ios::rdbuf().
Copying out the string buffer.
rdbuf()->str()
Setting a new buffer.
__s | The string to use as a new sequence. |
Calls rdbuf()->str(s)
.
Controlling output for std::string.
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__mode | Whether 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.
__str | A string to copy as a starting buffer. |
__mode | Whether 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.
This hides both signatures of std::basic_ios::rdbuf().
Copying out the string buffer.
rdbuf()->str()
Setting a new buffer.
__s | The string to use as a new sequence. |
Calls rdbuf()->str(s)
.
Controlling input and output for std::string.
_CharT | Type of character stream. |
_Traits | Traits for character type, defaults to char_traits<_CharT>. |
_Alloc | Allocator 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.
__m | Whether 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.
__str | A string to copy as a starting buffer. |
__m | Whether 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.
This hides both signatures of std::basic_ios::rdbuf().
Copying out the string buffer.
rdbuf()->str()
Setting a new buffer.
__s | The 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.
_Tp | Type of element. |
_Alloc | Allocator 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.
Default constructor creates no elements.
Creates a vector with no elements.
__a | An allocator object. |
Creates a vector with copies of an exemplar element.
__n | The number of elements to initially create. |
__value | An element to copy. |
__a | An allocator. |
This constructor fills the vector with __n copies of __value.
Vector copy constructor.
__x | A 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.
__first | An input iterator. |
__last | An input iterator. |
__a | An 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.
__x | A 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.
__n | Number of elements to be assigned. |
__val | Value 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.
__first | An input iterator. |
__last | An 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.
__new_size | Number of elements the vector should contain. |
__x | Data 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.
__n | Number of elements required. |
std::length_error | If 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.
__n | The index of the element for which data should be accessed. |
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.
__n | The index of the element for which data should be accessed. |
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.
__n | The index of the element for which data should be accessed. |
std::out_of_range | If __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.
__n | The index of the element for which data should be accessed. |
std::out_of_range | If __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.
__x | Data 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.
__position | An iterator into the vector. |
__x | Data to be inserted. |
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.
__position | An iterator into the vector. |
__n | Number of elements to be inserted. |
__x | Data 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.
__position | An iterator into the vector. |
__first | An input iterator. |
__last | An 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.
__position | Iterator pointing to element to be erased. |
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.
__first | Iterator pointing to the first element to be erased. |
__last | Iterator pointing to one past the last element to be erased. |
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.
__x | A 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.
__x | A vector. |
__y | A vector of the same type as __x. |
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.
__x | A vector. |
__y | A vector of the same type as __x. |
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.
_Alloc | Allocator 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.
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.
< User's data.
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.
_Tp | Type of element. |
_Alloc | Allocator 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
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.
__args | An instance of user data. |
Allocates space for a new node and constructs a copy of __args in it.
Default constructor creates no elements.
Creates a list with no elements.
__a | An allocator object. |
Creates a list with copies of an exemplar element.
__n | The number of elements to initially create. |
__value | An element to copy. |
__a | An allocator object. |
This constructor fills the list with __n copies of __value.
List copy constructor.
__x | A 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.
__first | An input iterator. |
__last | An input iterator. |
__a | An 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.
__x | A 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.
__n | Number of elements to be assigned. |
__val | Value 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.
__first | An input iterator. |
__last | An 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.
__new_size | Number of elements the list should contain. |
__x | Data 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.
__x | Data 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.
__x | Data 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.
__position | An iterator into the list. |
__x | Data to be inserted. |
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.
__position | An iterator into the list. |
__n | Number of elements to be inserted. |
__x | Data 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.
__position | An iterator into the list. |
__first | An input iterator. |
__last | An 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.
__position | Iterator pointing to element to be erased. |
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.
__first | Iterator pointing to the first element to be erased. |
__last | Iterator pointing to one past the last element to be erased. |
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.
__x | A 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.
__position | Iterator referencing the element to insert before. |
__x | Source 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.
__position | Iterator referencing the element to insert before. |
__x | Source list. |
__i | Iterator 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.
__position | Iterator referencing the element to insert before. |
__x | Source list. |
__first | Iterator referencing the start of range in x. |
__last | Iterator 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.
__value | The 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.
_Predicate | Unary 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.
_BinaryPredicate | Binary 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.
__x | Sorted 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.
_StrictWeakOrdering | Comparison function defining sort order. |
__x | Sorted list to merge. |
__comp | Comparison 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.
__x | A list. |
__y | A list of the same type as __x. |
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.
__x | A list. |
__y | A list of the same type as __x. |
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.