Hi, could you please help me understand this error message? I have a function taking an object of some class by reference, and it gives me this error message when compiled with either GCC or Clang. The relevant code is as shown below:
1 2 3
bool foundInTree = (testContainer.find(i) != testContainer.end());
//find returns a custom defined const_iterator object for testContainer
//testContainer is a const reference to some custom defined container
that's the line producing the error, and this is the function:
what the error message says is that the compiler can't "convert" from const_btree_iterator<T>, which is returned by testContainer.find(i), to const_btree_iterator<T>&, which is what's expected. Could I have some help please? Thanks in advance
hi, thanks for the quick reply. I've actually written a series of overloaded functions that compare const_iterators and iterators with each other. I've found out that the cause of the error is that I'm trying to bind a non-constant reference to an rvalue. Thank you anyway for your help.