On 6/21/06, Roman Yakovenko <rom...@gm...> wrote:
> Good evening. I need some help. I don't know what is preferred behaviour of
> py++ in next situation. In order to use indexing suite, class X should
> define operator==. What py++ should do when it found usage of
> std::vector< X >?
>
> The generated code
> class_< vector< X > >( "Xs" )
> .def( vector_indexing_suite< vector<X> > );
>
> will not compile.
> There are 2 options:
> 1. py++ will not generate that code. Very bad option, because user
> will get wrong
> filling, that created bindings just work. All functions that use
> vector< X > are
> non-callable from Python.
>
> 2. Generate code. The bad side of this approach is compiler error
> message - it is
> pretty big and scaring. It can confuse any user, but at least he
> will aware of
> the problem. py++ can generate some comment within source code that will
> help the user to understand the problem quickly.
I prefer the second case with an appropriate warning message generated
and a comment.
Lakin
|