devxlogo

Tip Bank

Creating help string for Enum constants

I’ve been trying to find a way to assign helpstrings for Enums in Visual Basic. The Class builder utility does that only for methods, events, and properties, but not for

BTree – A class for managing binary trees

Option Explicit’ Class Name : BTree’ Author : John Holfelder’ Date : 17-Apr-2000 12:08 pm’ Description : This class is a way of creating Binary search’ trees. Instead of pointers

Trimming a Vector

Suppose you create a vector and fill it with elements: vector MyVector;MyVector.reserve(20);for (int i=0 ; i tmp(MyVector);MyVector.swap(tmp); The vector temp has the same number of elements that MyVector has. By

Use a String Object to Read Input Safely

One of the common sources for bugs and security risks is using a fixed size char array as a buffer for inputting data. For example: char buff[20];cout > buff; //

The calloc() Function

The standard C library declares the function calloc() in as follows: void *calloc(size_t elements, size_t sz); calloc() allocates space for an array of elements, each of which occupies sz bytes

Equivalence Relationship in STL

Certain STL containers and algorithms require that you overload operator < for the class type they store as elements in order to sort and compare these elements. Note that STL