[C++-sig] Pyplusplus: operators <</>> not supported?

Roman Yakovenko roman.yakovenko at gmail.com
Wed Jun 4 12:31:08 CEST 2008


On Wed, Jun 4, 2008 at 12:41 PM, Hans Meine
<meine at informatik.uni-hamburg.de> wrote:
> Am Dienstag, 03. Juni 2008 19:43:37 schrieb Roman Yakovenko:
>> I think there is small confusion, but it doesn't change the facts.
>> Py++ doesn't support operators << and >>
>> which write to some stream.
>>
>> I did not know that it is possible to define shift operators for
>> classes. Can you point me to the relevant documentation?
>
> For Python or C++?  Sorry if I state something obvious, but I am not sure what
> you're asking about, so here is both:
>
> In Python, it's __[i][l/r]shift__, in C++ it's simply a matter of defining
> operator<</>>/<<=/>>= like all other operators.  Given your C++ skills, you
> probably meant the former, for which the docs are at
> http://docs.python.org/ref/numeric-types.html

No, I meant C++ :-)

I found some definitions in MSDN for shift operators, but I didn't see
how I can redefine them for class.
Py++ has to distinct between shift and stream operators.


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



More information about the Cplusplus-sig mailing list