List:MySQL++« Previous MessageNext Message »
From:Pedro Lamarão Date:March 20 2006 3:44pm
Subject:Re: Row::at() doesn't take const int?
View as plain text  
alan.alvarez@stripped escreveu:
> Doing something like Row[1] will produce a compile-time error. Since 1 is created as
> a constant by the compiler. The compiler won't explicitely cast from non-const to const.
> it will, however, do the opposite. So I think it'd be better to take a constant since the
> value is not modified anyways, or so I think. I could be wrong, which is why I was
> asking.
>   
This would be true if Row[] was operator[](int&): an rvalue doesn't bind
to a non-const reference.
But if that operator is operator[](int) there is not problem: the
parameter, rvalue or lvalue, will be copied into the function in all cases.

Declaring a function like this:

void
f (const int);

makes no sense.

-- 
Pedro Lamarão
Desenvolvimento

Intersix Technologies S.A.
SP: (55 11 3803-9300)
RJ: (55 21 3852-3240)
www.intersix.com.br

Your Security is our Business


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