Does anyone know what is wrong with the following code and how to fix
it? See gnu 3.4.3 errors below. (This code works fine with VS 2003 and
earlier versions of gnu).
I can get rid of some errors with:
TLength counter = std::vector<TData>::size();
Is that the right thing to do?
However I really don't know what to do about the error produced by:
std::vector<TData>::iterator it
Thanks.
template <typename TLength, class TData>
class CVariableLengthArray : public CDataType, public
std::vector<TData>
{
public:
explicit CVariableLengthArray (size_t n=0) : std::vector<TData>(n)
{}
private:
virtual void Write (CRawMemory & memory)
{
TLength counter = size();
// LINE 192
memory << counter;
for( std::vector<TData>::iterator it = begin(); it != end(); it++ )
// LINE 195
memory << (*it);
}
};
.../../DataTypes.h: In member function `virtual void
CVariableLengthArray<TLength, TData>::Write(CRawMemory&)':
.../../DataTypes.h:192: error: there are no arguments to `size' that
depend on a template parameter, so a declaration of `size' must be
available
.../../DataTypes.h:192: error: (if you use `-fpermissive', G++ will
accept your code, but allowing the use of an undeclared name is
deprecated)
.../../DataTypes.h:195: error: expected `;' before "it"
.../../DataTypes.h:195: error: `it' undeclared (first use this function)
.../../DataTypes.h:195: error: (Each undeclared identifier is reported
only once for each function it appears in.)
.../../DataTypes.h:195: error: there are no arguments to `end' that
depend on a template parameter, so a declaration of `end' must be
available