![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a reason why Row::at() doesn't take constant unsigned ints? same with the [] operator. |
#3
| |||
| |||
|
|
alan.alvarez (AT) us (DOT) army.mil wrote: Is there a reason why Row::at() doesn't take constant unsigned ints? same with the [] operator. Since size_type is a typedef for unsigned int, I guess you're complaining that it isn't const? What value could making it const possibly provide? Constness only matters with reference and pointer parameters. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsu...(DOT) army.mil |
#4
| |||
| |||
|
|
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 = |
|
=20 This would be true if Row[] was operator[](int&): an rvalue doesn't bind |
#5
| |||
| |||
|
|
Doing something like Row[1] will produce a compile-time error. |
#6
| |||
| |||
|
|
alan.alvarez (AT) us (DOT) army.mil wrote: Doing something like Row[1] will produce a compile-time error. Are you saying that this code won't compile: #include <iostream void foo(int bar) { std::cout << bar << std::endl; } int main() { foo(42); return 0; } ? If so, please give platform and compiler details. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsu...(DOT) army.mil |
#7
| |||
| |||
|
|
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= |
|
=20 Respectfully, Alan Alvarez. =20 ----- Original Message ----- From: Warren Young <mysqlpp (AT) etr-usa (DOT) com Date: Monday, March 20, 2006 3:28 pm Subject: Re: Row::at() doesn't take const int? =20 alan.alvarez (AT) us (DOT) army.mil wrote: Is there a reason why Row::at() doesn't take constant unsigned ints? same with the [] operator. =20 Since size_type is a typedef for unsigned int, I guess you're=20 complaining that it isn't const? What value could making it const=20 possibly provide? Constness only matters with reference and=20 pointer=20 parameters. =20 --=20 MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: =20 http://lists.mysql.com/plusplus?unsu...(DOT) army.mil =20 |
#8
| |||
| |||
|
|
Though the below code compiles I'm getting the follwoig error from the = compiler: SqlManager.cpp:167: error: ambiguous overload for 'operator[]' in 'l_ro= w[0]' /usr/local/include/mysql++/row.h:114: note: candidates are: const mysql= pp::ColData mysqlpp::Row: perator[](const char*) const/usr/local/include/mysql++/row.h:126: note: const mysql= pp::ColData mysqlpp::Row: perator[](unsigned int) constHere's the code for line 167: return l_row[0]; so I'm forced to do the following: unsigned int l_tmp =3D 0; return l_row[l_tmp]; =20 A simpler workaround would be: |
#9
| |||
| |||
|
|
return l_row[0]; |
perator[] are for
perator[])
#10
| |||
| |||
|
|
perhaps this problem could be solved by creating an additional operator[] which takes just a "const int", |
![]() |
| Thread Tools | |
| Display Modes | |
| |