p****3 发帖数: 32 | 1 compiling error message:
array.h:61: passing `const array' as `this' argument of `int
array::size () [with Type = v_node]' discards qualifiers
array.h:64: passing `const array' as `this' argument of `Type
array::get (int) [with Type = v_node]' discards qualifiers
part of array.h code here:
template class array
{
protected:
Type* arr; // Pointer to the block where it is stored
int sz; // We will stick to PASCAL convention of
|
t****t 发帖数: 6806 | 2 inline int size() const { return sz; }
inline int get(int) const;
【在 p****3 的大作中提到】 : compiling error message: : array.h:61: passing `const array' as `this' argument of `int : array::size () [with Type = v_node]' discards qualifiers : array.h:64: passing `const array' as `this' argument of `Type : array::get (int) [with Type = v_node]' discards qualifiers : part of array.h code here: : template class array : { : protected: : Type* arr; // Pointer to the block where it is stored
|
r****t 发帖数: 10904 | 3 这个 code 应该是为 gcc<3 写的。
【在 p****3 的大作中提到】 : compiling error message: : array.h:61: passing `const array' as `this' argument of `int : array::size () [with Type = v_node]' discards qualifiers : array.h:64: passing `const array' as `this' argument of `Type : array::get (int) [with Type = v_node]' discards qualifiers : part of array.h code here: : template class array : { : protected: : Type* arr; // Pointer to the block where it is stored
|