samedi 28 octobre 2017

what is the purpose of template class in c++

I cannot understand what is template class used for? I am new to c++. Can I get a detail explanation.

// constructing unordered_sets
#include <iostream>
#include <string>
#include <unordered_set>

template<class T>
T cmerge (T a, T b) { T t(a); t.insert(b.begin(),b.end()); return t; }

std::unordered_set<std::string> fifth ( cmerge(third,fourth) );       // move

Aucun commentaire:

Enregistrer un commentaire