List:MySQL++« Previous MessageNext Message »
From:Chris Frey Date:September 18 2005 1:12am
Subject:[patch] row::operator[](int)
View as plain text  
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.
 
Thread
[patch] row::operator[](int)Chris Frey18 Sep
  • Re: [patch] row::operator[](int)Chris Frey18 Sep
  • Re: [patch] row::operator[](int)Warren Young19 Sep