kelvin.koogan@hotmail.com wrote:
Quote:
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?
|
Yes.
Quote:
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++ )
|
try
for( typename std::vector<TData>::iterator it = begin(); it != end();
it++ )
Quote:
// LINE 195
memory << (*it);
}
};
>
|
[snip]
BTW.: without knowing more details, it is somewhat hard to be sure; however,
there are only a few cases (actually I know only one case) where inheriting
publicly from std::vector is a good thing to do -- and your class does not
look like one of them. Search the archives of this group and its moderated
twin for discussions of this topic. Very likely, you will find that your
design is asking for trouble.
Best
Kai-Uwe Bux