devxlogo

Tip Bank

DevX - Software Development Resource

The Perils of a Container’s Reallocation

When a container reallocates its elements, their addresses change correspondingly. Consequently, the values of existing iterators are invalidated: #include #include using namespace std;void main() { list payroll; payroll.push_back(5000.00); list::iterator p

DevX - Software Development Resource

Pointers to Members of a Template Class

You can define a pointer to a class template member. For example, you can use the specialization vector: typedef void (vector< int >::*v_vi_szt) (size_t); // v_vi_szt is used to hide

DevX - Software Development Resource

Reflecting on a Classy String

Java’s reflection API allows the instantiation of an object using only its String description. A Java application can determine the class of an object from the associated string and then

DevX - Software Development Resource

Putting out the Trash Using the gc() Call

The gc() call on the Java Virtual Machine’s garbage collector is often misunderstood. One of the reasons Java is such an easy language to program in is that it takes

DevX - Software Development Resource

Efficient Use of the Vector Class

The Vector class in java.util is one of the most frequently used classes in Java development. It almost makes the problem of memory management non-existent, unlike a fixed-size array. However,