sizeof an array data member

Eljay Love-Jensen eljay@adobe.com
Fri Jun 13 13:43:00 GMT 2003


Hi Matt,

sizeof(float*) / sizeof(float) is "1" because...
sizeof(float*) is PROBABLY 4 bytes
sizeof(float) is USUALLY 4 bytes on most platforms.

What you want to do is this...

     const int operator[](const char *) const {
          return data.size();
     }

private:
     vector<float> data;

Sincerely,
--Eljay




More information about the Gcc-help mailing list