List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:September 19 2005 5:16pm
Subject:Re: [patch] row::operator[](int)
View as plain text  
Chris Frey wrote:
> +	const ColData operator [](int i) const

It happens to work, but it makes me nervous.

The problem is that const_subscript_container requires 
operator[](SizeType), where SizeType is an unsigned int.  That's 
reasonable, since these containers should never be indexed with a 
negative number.  But '0' outside any other context is a plain int in 
C++, which is where the ambiguity comes in.  With this second integer 
overload, we essentially have duplicate code, and all the problems that 
come with it.

I'd be less against simply changing SizeType to be a plain int and 
letting that change ripple through the hierarchy (don't forget Fields 
and FieldNames!) but that would break the ABI.
Thread
[patch] row::operator[](int)Chris Frey18 Sep
  • Re: [patch] row::operator[](int)Chris Frey18 Sep
  • Re: [patch] row::operator[](int)Warren Young19 Sep