on Stack Overflow
See other posts from Stack Overflow
or by FredOverflow
Published on 2010-06-02T13:30:19Z Indexed on 2010/06/02 13:34 UTC
Read the original article Hit count: 297
boost::operators automatically defines operators like
+ based on manual implementations like
+= which is very useful. To generate those operators for
T, one inherits from
boost::operators<T> as shown by the boost example:
class MyInt : boost::operators<MyInt>
I am familiar with the CRTP pattern, but I fail to see how it works here. Specifically, I am not really inheriting any facilities since the operators aren't members.
boost::operators seems to be completely empty, but I'm not very good at reading boost source code.
Could anyone explain how this works in detail? Is this mechanism well-known and widely used?
© Stack Overflow or respective owner