[C++-sig] Re: C arrays mk 2

David Abrahams dave at boost-consulting.com
Wed Oct 15 21:23:39 CEST 2003

Raoul Gough wrote:

> David Abrahams <dave at boost-consulting.com> writes:
>>Niall Douglas wrote:
>>>This is for reference only to anyone else that might have this
>>>problem and searches the list archive in times to come. People who
>>>don't like macros beware!
>>>My most gracious thanks to Raoul Gough for helping me in
>>>this. You're now in the acknowledgements for the library.
>>This appears to me to be more complicated and less reliable than
>>neccessary.  Why not just give your Python MyList class __len__ and
>>__getitem__ functions?
> I suppose it depends how rich an interface he wants on the Python
> side. The two methods you named are sufficient for a lot of cases
> (almost everything, in fact), but if he wants slice support or
> __setitem__, it might still pay off to use the container suite. 

Sure.  But his example just creates an iterator (the extremely hard 
way), and __len__ + __getitem__ already gets you an iterator and more.

 > I
> don't know - all of that C-style array stuff looks like doing things
> the hard way to me.

At least he's having fun ;-)

More information about the Cplusplus-sig mailing list