Whats This onE?

typedef vector<Widget, SpecialAllocator<Widget> > WidgetContainer;

I came across this syntax on Vector recently on a book about STL containers and I was surprised to observe such a declaration!

I have used vector<T> but whats vector<T1,T2>?
http://www.CPlusPlus.com/vector

As you can see, the template takes two parameters, but the second one is optional.

vector Reference wrote:
Allocator: Type of the allocator object used to define the storage allocation model. By default, the allocator class template for type T is used, which defines the simplest memory allocation model and is value-independent.
Last edited on
Topic archived. No new replies allowed.