Stuck on compile error

lrtaylor@micron.com lrtaylor@micron.com
Fri Jan 16 23:39:00 GMT 2004


If believe the problem is that erase expects two iterators, saying where to erase from and to.  The expression "&tripletVec_[numTriplets]" does not return an iterator, but the element stored at numTriplets.  So, it's a type mismatch.

Cheers,
Lyle


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
Behalf Of Gary Cote
Sent: Friday, January 16, 2004 4:08 PM
To: gcc-help@gcc.gnu.org
Subject: Stuck on compile error



I'm upgrading from gcc 2.96 to gcc 3.2.3, fixing
the various compiler warnings and errors in our
existing code base. One error has got me stumped.
Can anyone please tell me what's wrong with this?

I've boiled it down to its essential elements.


-------------

#include <vector>
using namespace std;

class ttiAucTriplet {

int i;
};

typedef vector<ttiAucTriplet> tVec;

void foo() {
    tVec tripletVec_;
    int numTriplets = 0;

    tripletVec_.erase(tripletVec_.begin(), &tripletVec_[numTriplets]); 
}



More information about the Gcc-help mailing list