[C++-sig] Re: Random access iterators, and sequence protocol.

Nikolay Mladenov nickm at sitius.com
Sat Jul 5 20:37:18 CEST 2003


Ok. Than may be you could write an index_check<container>  call policy
that 
does the index checking in the precall...

Prabhu Ramachandran wrote:
> 
> >>>>> "NM" == Nikolay Mladenov <nickm at sitius.com> writes:
> 
>     >> To do this __getitem__ needs to generate an IndexError when the
>     >> index is greater than or equal to size.  Do I _have_ to
>     >> register an exception translator from something like
>     >> std::range_error?  Is there an easier way to do this?
> 
>     NM> I don't think you can do it any easier than that. And besides,
>     NM> if you export std::range_error this will automatically apply
>     NM> to your future container exports.
> 
> True, but if you don't want to add the size related checks in the C++
> library that you are wrapping (for whatever reason) and instead want
> to do it in the wrapper functions then you'd need to write the wrapper
> for each container.  Anyway, since .pyste files can import .py files
> it should be easy to share code that does this internally and one
> would merely have to write one function that does the job.
> 
> Thanks.
> 
> cheers,
> prabhu





More information about the Cplusplus-sig mailing list