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

Search the Tips
Tip Bank > C++ > STL

STL - Page 3

41-60 of 87     Previous     Next
Bool Values
by DevX Pro
How do I make 1 bool take 1 bit instead of 1 byte?
The binary_search Algorithm
by Danny Kalev
STL's binary_search() algorithm traverses a sequence and returns a Boolean value indicating whether the sought-after element exists in that sequence. binary_search() is declared in the header ...
Useful STL Terminology
by Danny Kalev
Here are some key terms that you may find useful for reading Standard Template Library (STL) literature and documentation.
The unique() Algorithm
by Danny Kalev
STL's unique() algorithm eliminates all but the first element from every consecutive group of equal elements in a sequence of elements. unique() takes two forward iterators, the first of which marks ...
STL Thread Safety
by DevX Pro
Does STL use any synchronization, or do I have to implement it myself by critical section?
The reverse() Algorithm
by Danny Kalev
Another useful STL algorithm is reverse(). This algorithm reverses the order of elements in a specified sequence. reverse() takes two iterators that mark the sequence's beginning and end, ...
Merging Two Lists
by Danny Kalev
Merging two lists isn't only a popular homework assignment; rather, this task is sometimes needed in real world programming as well. Fortunately, you don't have to reinvent the wheel anymore. STL's ...
The replace() Algorithm
by Danny Kalev
Another useful STL algorithm is replace(), which is defined in the standard header <algorithm> and has the following ...
Volatile Semantics and Container Objects
by Danny Kalev
Volatile objects are used in multithreaded applications and applications that map hardware devices into registers. Although you can declare an STL container object with the volatile qualifier, you ...
The Possible Deprecation of vector<bool> and Its Consequences
by Danny Kalev
In the early days of STL, C++ creators decided to include a specialized form of the vector container class, namely vector < bool >. In this specialized vector, bits serve as the container's ...
Iterators Aren't Pointers
by Danny Kalev
< ...
Accessing Arrays
by DevX Pro
Normally, you access an array by the number of the element you want. Is it possible, in C++, to access an element by the value and return the number?
Why you shouldn't store auto_ptr objects in STL containers
by Danny Kalev
Most C++ users already know that they shouldn't use auto_ptr objects as elements of STL containers. However, fewer users know exactly why this is so. ...
Efficiency of STL or Quality of Implementation?
by Danny Kalev
I often hear people ask whether it's possible to write code that is quicker than STL. ...
Inserting Different Types of Objects in a STL List
by DevX Pro
I would like to know if it is possible to insert objects of different types in the same STL list. I have an object A and two objects AB and AC that inherit A (overloading some methods), and I need to build a list of objects of type AB or AC, so that I can go through the list executing one of the overloaded methods without knowing which of them (A.method, AB.method, or AC.method) is executed. How can I do this?
STL and User-Defined Classes
by DevX Pro
I'm new to the Standard Template Library. How do I incorporate a user-defined class into a hash_map? What functions do I need to overload? I get compiler errors when I try to insert into my hash_map for even the simplest of classes.
Using the random_shuffle Algorithm
by Danny Kalev
STL includes the random_shuffle() algorithm. As the name suggests, this algorithm randomly shuffles the elements of a sequence. It takes two arguments, the first of which is an iterator that points ...
Avoid Excessive use of Fully Qualified Names
by Danny Kalev
To some extent, the use of fully qualified names is the recommended way of referring to namespace members because it uniquely identifies and yet it avoids name conflicts. For ...
Bit Classes
by DevX Pro
Are there power bit set classes around that can do what Verilog, VHDL can do so easily? a[3:2,0] = b[4:1] & c[5]; // collections of width n mixed with 1 Doing this bit by bit (wire by wire), follows the textbook but is also slow. I could "" everything and interpret, or write a full blown compiler for a tiny lang, but using C++/classes is much more expresive. Any suggestions?
An Alternative STL Implementation
by Danny Kalev
The STLport organization offers an alternative implementation of the Standard Template Library. You can install the alternative instead of using the existing STL implementation shipped with your ...
41-60 of 87     Previous     Next