[C++-sig] Getting operator[]() to throw RangeError using py++

Roman Yakovenko roman.yakovenko at gmail.com
Sun Jan 6 08:22:00 CET 2008


On Jan 6, 2008 3:23 AM, David Wolfe <dwolfe at gforcetech.com> wrote:
> Using py++, can anyone help me figure out how to get operator[]() to
> throw a RangeError for some vector classes I'm trying to wrap?  The
> default behavior is a bit undesirable:
> ...
> How can I firewall off 'garbage' index values from operator[]()?
>
> Any advice much appreciated... :-)

Do you insist on using C++ to solve this problem?

If not than:
    http://boost.org/libs/python/doc/tutorial/doc/html/python/techniques.html#python.extending_wrapped_objects_in_python
else:
    http://language-binding.net/pyplusplus/documentation/how_to.html#how-to-expose-function-which-has-hand-written-wrapper

HTH



-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list