O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User-Defined Classes and the using Keyword

Usually you want to use STL with classes and types other than the built-in ones—int, char, and so on—because you need to manipulate user-defined types and classes. For example, you might want to create a linked list of struct data elements.

To do this, you need to derive your own classes from the templates or at least add your own data to the container definition. This allows you to provide functionality that does not rely on built-in predicates and operators.

This implies that you need to overload some of the operators, or at least provide your own operators to perform some of the vital functions that the underlying built-in types use when you create the ranges.

Generally, these overloads will be construction, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required