[C++-sig] operator definitions

Neal Becker ndbecker2 at gmail.com
Sat Apr 8 17:18:40 CEST 2006


David Abrahams wrote:

> Neal Becker <ndbecker2 at gmail.com> writes:
> 
>>> 
>>> I don't know when this was added (or if it's been here all along and I
>>> have just never noticed), but this is amazingly clean and useful.
>>> Thanks!
>>> 
>>
>> It looks cool, but IMHO a bit too cute.  AFAIK, it doesn't do anything
>> different than the IMHO much more clear:
>>     .def("__iadd__", plusAssignOp, return_self<>())
> 
> How is that more clear?  *I* certainly can't tell what it means.
> 

It's clear (to me) because it's consistent with the same method used to
define any other function.  In this case "clear" assumes the observer is
already familiar with the usual useage of .def.




More information about the Cplusplus-sig mailing list