February 2005
Beginner to intermediate
272 pages
4h 53m
English
In Disambiguating with Typename [49, 169], we saw how it is sometimes necessary to tell the compiler explicitly that a nested name is a type name so that the compiler can perform a correct parse. The same situation arises with nested template names.
The canonical example is in the implementation of an STL allocator. If you’re not familiar with STL allocators, don’t worry, be happy. Previous familiarity with them is not necessary for following this discussion, though a good deal of patience might be.
An allocator is a class type that is used to customize memory management operations for STL containers. Allocators are typically implemented as class templates:
The class template AnAlloc contains the nested ...
Read now
Unlock full access