double-ptr usage #3 – vector of pointers

We know the iterator in a vector is physically a raw ptr. If the elements in a vector are pointers, then the iterator is a double ptr. P238 [[STL tutorial]] has a simple yet complete example showing how to dereference the double-ptr twice.

By the way Same example also shows how to use a vector of Shape pointers to hold sub-class instances (of base class shape), like circles, squares…., then call the virtual methods defined in the class hierarchy.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s