Deducing type traits from a variable.
The following fails...
Code:
int main (void) {
std::vector<int> my_vector;
// Some code
// At this point, I dunno what my_vector is
my_vector::const_iterator ci = my_vector.begin(); // Error
// ...
return 0;
}
as does Code:
my_vector.const_iterator ci = my_vector.begin();
Basically, I want to avoid looking up the type, and let the compiler handle that for me. Am I trying to do something here that C++ doesn't allow? It seems like this should be possible somehow.