07.03.2013 Views

here - Chara - University of Illinois at Urbana-Champaign

here - Chara - University of Illinois at Urbana-Champaign

here - Chara - University of Illinois at Urbana-Champaign

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Lecture<br />

04—Templ<strong>at</strong>e<br />

P<strong>at</strong>terns I<br />

Chase Geigle<br />

Announcements<br />

Templ<strong>at</strong>e<br />

Specializ<strong>at</strong>ion<br />

Partial<br />

Templ<strong>at</strong>e<br />

Specializ<strong>at</strong>ion<br />

Templ<strong>at</strong>e<br />

Templ<strong>at</strong>e<br />

Parameters<br />

Next Time<br />

Motiv<strong>at</strong>ion<br />

When instanti<strong>at</strong>ing templ<strong>at</strong>es, you typically pass in a<br />

well-defined class as a templ<strong>at</strong>e parameter (e.g.<br />

vector).<br />

Wh<strong>at</strong> if you wanted to pass in a templ<strong>at</strong>e, and instanti<strong>at</strong>e<br />

it yourself in your templ<strong>at</strong>e function/class?<br />

Example: I want to instanti<strong>at</strong>e a container with multiple<br />

different parameters (like having two unordered maps<br />

with different key/value types).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!