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?