Witam, mam następującą klasę:
template<typename Key, typename Info>
class Sequence//single linked lsit
{
struct element
{
Key k;
Info i;
element *next;
};
element *head=0;
public:
Sequence();
~Sequence();
Sequence(const Sequence &x);
void add_after(Key where, Key k1, Info i1);
void remove_element(Key which);
void print_list();
int length();
void print_element(Key which);
Sequence operator=(const Sequence &x);
Sequence shuffle(const Sequence &s1, int start1, int step1, int rep1, const Sequence &s2, int start2, int step2, int rep2);
};
Mam problem z funkcją shuffle, mianowicie:
template<typename Key, typename Info>
Sequence<Key,Info> Sequence<Key,Info>::shuffle(const Sequence &s1, int start1, int step1, int rep1, const Sequence &s2, int start2, int step2, int rep2)
{
int a=s1.length();
//reszta funkcji
return *this;
}
Nie mogę uzyskać dostępu do funkcji length(). Nie wiem jak go rozwiązać. Błąd jaki wyskakuje przy kompilacji to:
error: passing ‘const Sequence<int, int>’ as ‘this’ argument discards qualifiers [-fpermissive]|
Wie ktoś jak to rozwiązać?