Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Search the Tips
Tip Bank > C++ > STL

STL - Page 4

61-80 of 87     Previous     Next
Forward-Declaring I/O Classes and Templates
by Danny Kalev
The standard header <iosfwd> contains forward-declarations of the I/O classes and templates. This header is sufficient to refer to any of the I/O classes and templates but not to apply ...
The Organization of STL Header Files: Algorithms, Iterators, Numerics and Other
by Danny Kalev
You can apply STL generic algorithms to a sequence of elements. They are defined in the header file <algorithm>. (on pre-standardized implementations, the name <algo.h> is used ...
The Organization of STL Header Files: Container Classes
by Danny Kalev
STL is divided into two major categories: containers and algorithms. Additional components are iterators, function objects, numeric facilities, allocators, and miscellaneous utilities. STL ...
Never Store Arrays of Objects in an auto_ptr
by Danny Kalev
The Standard Library's auto_ptr class template automatically destroys an object that is allocated on the free store when the current scope is exited. For ...
Class String Provides Two Member Functions
by Danny Kalev
Class std::string provides two member functions that return the const char * representation of its object: string::c_str() and string::data(). c_str() returns a null-terminated const pointer to char ...
What's in an Allocator?
by Danny Kalev
Every STL container uses an allocator that encapsulates the memory model that the specific platform uses. Allocators hide the platform-dependent details such as the size of pointers, memory ...
Using an Associative Array
by Danny Kalev
An associative array (also called map or dictionary) is an array for which the index does not have to be an integer. An associative array stores pairs of values. One serves as the key and the other ...
Uses of Reverse Iterators
by Danny Kalev
Reverse iterators are ordinary iterators except that they invert the semantic of the overloaded ++ and -- operators. They are useful when the elements of a container are accessed in reverse order. ...
Various Forms of Initializing std::string
by Danny Kalev
Class std::string can be initialized in five forms: by a C-string, by part of a C-string, by another string object, by a sequence of characters, or by part of another string object. For ...
std::string Should Never be Initialized With a NULL Pointer
by Danny Kalev
You can initialize std::string with a pointer to char. However, it does not check the pointer. When the pointer happens to be NULL the results are ...
The Minimum Requirements for STL Containment
by Danny Kalev
Any object that defines the copy constructor, default constructor, assignment operator and destructor as public members (either explicitly or implicitly) can be stored in STL containers. If you do ...
STL Containers Should Not Hold auto_ptr<> Members
by Danny Kalev
During reallocation, a container re-constructs its elements in a new memory location and destroys the original elements by invoking their destructor. Since the destructor of auto_ptr<> deletes ...
Using Predicate Objects to Alter Computation of a Generic Algorithm
by Danny Kalev
A predicate is an expression that returns either true or false. Similarly, a function object that returns a Boolean value is a predicate object. The Standard Template Library has several predicate ...
Easily Assign Containers
by Danny Kalev
STL containers overload the assignment operator, thereby allowing you to easily assign containers of the same type to one ...
The Copy Algorithm
by Danny Kalev
The Standard Library provides a generic copy function, which can be used to copy a sequence of objects to a specified target. The first and the second arguments of copy() are const iterators that ...
Why qsort is Still Useful in C++
by Danny Kalev
C++ defines a set of generic algorithms such as sort and find. However, the corresponding C algorithms, qsort and bsearch, are still useful in C++ programs for at least three ...
A Standard Bit Vector
by Danny Kalev
The Standard Template Library provides the specialization vector<bool>. The specialization is implemented in a way that squeezes each element into a single bit, rather than a bool variable. ...
The begin() and end() Member Functions of STL Containers
by Danny Kalev
All STL (Standard Template Library) containers provide the begin()/end() pair of member functions. The member function begin() returns an iterator that points to the first element of the ...
Const Iterators
by Danny Kalev
You can think of an iterator as a pointer to elements of a container. All STL (Standard Template Library) containers provide the basic iterator type along with its const counterpart. The const ...
STL Iterators are not Necessarily Pointers
by Danny Kalev
Most implementations of STL (Standard Template Library) use pointers as the underlying representation of iterators. However, an iterator doesn't have to be a pointer, and there's a good reason for ...
61-80 of 87     Previous     Next
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date