Topic: iterators and ->


Author: Tony Cook <tony@online.tmx.com.au>
Date: 1995/08/25
Raw View
Why don't iterators support the '->' operator - which would be more
convenient than '(*i).'?

I know this has been asked before - but the response has usually been
that -> won't work where the container is an 'int'.

But:
===
  14.3.3  Instantiation of operator->                       [temp.opref]

1 If  a  template  class  has  an operator->, that operator-> can have a
  return type that cannot be dereferenced by -> as long as  that  opera-
  tor->  is  neither  invoked, nor has its address taken, isn't virtual,
  nor is explicitly instantiated.
===

Is there some other reason?
--
        Tony Cook - tony@online.tmx.com.au
                    100237.3425@compuserve.com


---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]