Seuraavassa on taul_d.cpp:tä vastaava esimerkki toteutettu STL:n geneerisen vector-luokan avulla. Geneerisyys tarkoittaa sitä, että voidaan valita minkä "luokan olioita" vektori tallettaa.
// Malli vector-luokan käytöstä /vl-01
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
typedef vector<int> cTaulukko;
void tulosta(ostream &os, const cTaulukko &luvut)
{
cTaulukko::const_iterator p;
for (p=luvut.begin(); p<luvut.end(); ++p)
os << setw(5) << *p;
os << endl;
}
int main(void)
{
cTaulukko luvut;
luvut.push_back(0); luvut.push_back(2);
tulosta(cout,luvut);
return 0;
}