mercredi 20 juillet 2016

STL-pair-like triplet class - do I roll my own?

I want to use a triplet class, as similar as possible to std::pair. STL doesn't seem to have one. I don't want to use something too heavy, like Boost. Is there some useful FOSS non-restrictive-license triplet class I could lift from somewhere? Should I roll my own? Should I do something else entirely?

Edit: About std::tuple...

Is there really no benefit to a triplet-specific class? I mean, with tuple, I can't do

template<typename T1, typename T2, typename T3> std::tuple<T1, T2, T3> triple;

now can I? Won't I have to typedef individual-type-combination triples?

Aucun commentaire:

Enregistrer un commentaire