3 messages in com.mysql.lists.plusplus[patch] row::operator[](int)
FromSent OnAttachments
Chris Frey17 Sep 2005 18:11 
Chris Frey17 Sep 2005 18:22 
Warren Young19 Sep 2005 10:16 
Subject:[patch] row::operator[](int)
From:Chris Frey (cdf@netdirect.ca)
Date:09/17/2005 06:11:45 PM
List:com.mysql.lists.plusplus

Here's the int style patch to row.h, for evaluation. It's not as clean as the template solution, but there is less chance of weird error messages.

Applies against CVS.

- Chris

Index: lib/row.h =================================================================== --- lib/row.h (revision 1119) +++ lib/row.h (working copy) @@ -130,6 +130,18 @@

/// \brief Get the value of a field given its index. /// + /// If the index value is bad, the underlying std::vector is + /// supposed to throw an exception, according to the Standard. + /// + /// This function provides the int overload so row[0] is not + /// ambiguous. + const ColData operator [](int i) const + { + return at(i); + } + + /// \brief Get the value of a field given its index. + /// /// If the index is out-of-bounds, the underlying vector is supposed /// to throw an exception according to the C++ Standard. Whether it /// actually does this is implementation-dependent.