On Apr 23, 2010, at 12:37 PM, Jay Pipes wrote:

> On Fri, Apr 23, 2010 at 11:57 AM, Brian Aker <[email protected]> wrote:
>> Hi!
>> 
>> This ties into a bigger question of how to return error/information from 
>> callers. Stewart and I spent a bit of time talking about this at the 
>> conference (though with no conclusion). The basic idea is to return an 
>> object that is minimal copy upon return (aka... no memory allocation and the 
>> hit cost is low).
> 
> Which is precisely why I proposed using std::pair<>'s (or
> boost::tuple).  There is no copy overhead in most situations (due to
> all modern compilers implementing the return value optimization.
> Please see: http://en.wikipedia.org/wiki/Return_value_optimization).
> This is the reason that the STL's std::map<>::insert() method returns
> a std::pair<iterator, bool> as do other STL algorithms.

Sure, but map::insert() will never have a need to return more info than
what can fit in std::pair.  In your proposed design, if there is ever a need
to return more state info, your return type suddenly needs to change.
That may not ever happen, so it may be a non-issue.

As we discussed on IRC, I propose maintaining private state internal
to Cursor, but as you said, anything is better than the way it is now.

/Dave



_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to