This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: STL defect?


what are you trying to do in the example? try the following example,
operator-> works for me here. I don't see what you are "pointing at" in
your example. The error you get is not that operator->() isn't
implemented, just that you have used it incorrectly. Notice the error
about aggregate type. Consider what you would do with a pointer to a
double. I can't think of any case where you would need to use the
operator-> on it. it is not an aggregate of additional parts.

#include <iostream>
#include <vector>
#include <deque>

class A {
public:
  double x;
};

int main(int argc, char *argv[]) {

  vector<A> V;
  A a;
  a.x = 1.1;

  V.push_back(a);  

  vector<A>::iterator I;

  I = V.begin();
  
  cout << I->x << "\n";

  return 0;
};


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]