Boost logo

Boost :

Subject: [boost] [operators] A modern SFINAE-based version of boost::operators?
From: Beman Dawes (bdawes_at_[hidden])
Date: 2017-11-13 14:20:22


Peter Sommerlad, committee member and C++Now presenter who often proposes
additions to fill in holes in the standard library, asked me:

Are you aware of anybody who tried to provide a boost::operators style of
automatically providing additional operators with a single base class that
through SFINAE injects all possible operators based on the ones defined in
the template parameter? This won't give you the control of the current
boost::operators, but would be much easier to teach.

For example

struct Me : make_operators_for<Me>{
Me& operator+=(Me const&); // You get +
bool operator<(Me const&) const; // You get all relops (<=> will make that
obsolete)
Me& operator++(); // you get postfix
//etc.
};

Today we have the facilities and compilers to make that happen.

What do you think? Who should I ask?

Anyone doing any work on operators or have any thoughts about updating
boost::operators?

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk