I'm betting this has been discussed before, but I can't find the right set
of words to look it up in google groups, so here goes. If the issue has
been beat to death, please just point me at the discussion to read, thanks!
Is there a reason we can't use an object name in place of a type name to
access typedefs and/or static fields of the type? Asking by example, why
hasn't this been made valid:
foo::iterator i = find(foo.begin(),foo.end(),bar);
instead of the current:
vector<int>::iterator i = find(foo.begin(),foo.end(),bar);
If the type of foo ever changes, the second version breaks but the first
wouldn't. I know the break is trivial to fix, and I know typedef's can
mitigate the problem, but even then if foo changed to a different typedef
the code would break. The first version would tightly bind the iterator
type to the type of the container, which as far as I can tell would be a
good thing. Short of an automatic type specifier, this solves the problem
in a pretty logical way that looks like it would be (relatively) simple to
implement. Is it:
- Planned for the next revision!
- Solves a problem that isn't worth solving?
- Not high enough priority?
- Seriously flawed in some manner?
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]