It is easy given a container to get the associated iterators, example:
std::vector<double>::iterator i; //An iterator to a std::vector<double>
I was wondering if it is possible, given an iterator type, to deduce the type of the "corresponding container" (here I am assuming that for each container there is one and only one (non-const) iterator).
More precisely, I would like a template metafunction that works with all STL containers (without having to specialize it manually for each single container) such that, for example:
ContainerOf< std::vector<double>::iterator >::type
evaluates to
std::vector<double>
Is it possible?
If not, why?
Thank you in advance for any help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…