@keskiverto
Can you decipher the error messages? |
No. This is the first time I'm about to decipher these kinds of errors. So, firstly let me decipher my previous error message and if I succeed in deciphering it correctly, you give me "one" more error message as my next deciphering step, please.
expression having type 'const comp' would lose some const-volatile qualifiers in order to call 'bool comp::operator ()(const Fruit *,const Fruit *)' 1614
It says, there's some expression which has type 'const comp' which loses some qualifier of type 'const-volatile' (?) when used to call 'bool comp::operator ()(const Fruit *,const Fruit *)'.
On the other hand, from
https://en.cppreference.com/w/cpp/named_req/BinaryPredicate, we have this line:
In addition, evaluation of that expression is not allowed to call non-const member functions of the dereferenced iterators.. It seems that the user-defined predicate function must have a
const qualifier at the end or its declaration. Stroustrup has also used it that way in the chapter, but it's hard to remember each and every word of the chapter's script! :(
Now how was my deciphering? If it's correct then I'm ready for more error messages to decipher, of course one-by-one.
@coder777
unique_ptr cannot be copied. Hence things like the initializer list on line 25 are not possible. |
Yes, for that initializer list the copy constructor is called. But what if I forget to call
delete for every element of the class
set and we want to use a
shared_ptr to both bypass copying limitation and free memory as well? How to use this smart pointer in the project?
The global operator obviously does not accept pointer. |
Does it mean that any global operator function doesn't accept any of its parameters in type pointer?
I've already included that header but the error still exists!