In the user manual, 3.4 Exceptions says the following:
"The largest set of non-optional exceptions are those from the
Standard C++ Library. For instance, if your code said "row[21]" on a
row containing only 5 fields, the std::vector underlying the row
object will throw an exception. (It will, that is, if it conforms to
the standard.) You might consider wrapping your program's main loop in
a try block catching std::exceptions, just in case you trigger one of
these exceptions."
~ http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#exceptions
This has me confused. vector::operator[] does not throw exceptions
for out-of-range indexes, so I was surprised that Row does.
I looked at the source for Row
(http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/row.cpp?rev=2011&view=markup),
and it seems that operator[] is actually calling the vector's at.
That seems like a waste of time, since it's already checked that the
index is valid. And in the case that the index *is* out of range, it
throws a custom exception, not the one from vector::at, contrary to
the documentation.
Thanks,
~ Scott