Topic: Extension to scope or member access operator
Author: "Ruslan Abdikeev" <ruslan_abdikeevRemoveIt@hotmail.com>
Date: Thu, 29 Mar 2001 19:38:15 GMT Raw View
As Mark Blewett has mentioned in "Proposal: two real uses for the auto
keyword" thread,
elegant extension to scope or member access operator is desired.
Instead of annoying sequences like
for(std::vector::iterator i= v.begin(); i!= v.end(); i++) {...}
more elegant, more simpler and inherently low-cohesion
for(v.iterator i= v.begin();...
or
for(v::iterator i= v.begin();...
is proposed.
It seems to be not very difficult (especially in v::iterator case).
Why not?
Sincerely,
Ruslan Abdikeev
Brainbench MVP for Visual C++
http://www.brainbench.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: Michiel Salters<Michiel.Salters@cmg.nl>
Date: Fri, 30 Mar 2001 19:30:56 GMT Raw View
In article <9a02ll$70k$1@news.wplus.spb.ru>, Ruslan Abdikeev says...
[SNIP]
>Instead of annoying sequences like
>
> for(std::vector::iterator i= v.begin(); i!= v.end(); i++) {...}
>
>more elegant, more simpler and inherently low-cohesion
>
> for(v.iterator i= v.begin();...
>or
> for(v::iterator i= v.begin();...
>
>is proposed.
>
>It seems to be not very difficult (especially in v::iterator case).
>Why not?
>Sincerely,
>Ruslan Abdikeev
Could you be more specific ?
I can read your question in at least two ways -
Q) Why is it not very difficult ?
A) Because the compiler already knows the type of v
or
Q) Why is it not (yet) C++ ?
A) Because there are many forms possible. Another proposal was to
use typeof(), so the example can be written typeof(v)::iterator
As a C++ community, we don't know what is best.
IIRC, g++ already has __typeof(). Now if people favoring another
syntax would also add that to g++, we could compare the different
approaches.
Michiel Salters
--
Michiel Salters
Consultant Technical Software Engineering
CMG Trade, Transport & Industry
Michiel.Salters@cmg.nl
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]