List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:March 21 2006 7:51pm
Subject:Re: Row::at() doesn't take const int?
View as plain text  
alan.alvarez@stripped wrote:
> 
>         return l_row[0];

That's an ancient problem with MySQL++ and it has nothing to do with 
constness.  It's because the two overloads for Row::operator[] are for 
const char* and unsigned int.  Neither is the same type as a literal 0, 
so the compiler has to decide which to coerce the 0 to.  The ambiguous 
conversion error tells you that the compiler can't decide between the 
overloads because 0 converts to either equally well.

You'll find that if you change your subscript to 1, the code compiles, 
because 1 can't be cast to const char* like 0 can.

This problem is documented in the reference manual.  (Row::operator[]) 
The immediate solution is to use at() instead, which doesn't have the 
const char* overload.

In the future, I think we can fix it by changing the unsigned int 
overloads to plain int, but that would break the ABI, so we can't do 
that until v3.0.  If you want v3.0 to come faster, submit patches for 
items in the Wishlist!
Thread
Row::at() doesn't take const int?alan.alvarez18 Mar
  • Re: Row::at() doesn't take const int?Warren Young20 Mar
Re: Row::at() doesn't take const int?alan.alvarez20 Mar
  • Re: Row::at() doesn't take const int?Pedro LamarĂ£o20 Mar
  • Re: Row::at() doesn't take const int?Warren Young20 Mar
  • Re: Row::at() doesn't take const int?Johannes Schaub21 Mar
    • Re: Row::at() doesn't take const int?Warren Young21 Mar
Re: Row::at() doesn't take const int?alan.alvarez20 Mar
  • Re: Row::at() doesn't take const int?Pedro LamarĂ£o21 Mar
  • Re: Row::at() doesn't take const int?Warren Young21 Mar