C++ Logo


Advanced search

Subject: [std-proposals] Template qualifiers
From: Phil Bouchard (phil_at_[hidden])
Date: 2019-09-29 07:52:06


How many time did we have to redundantly write the same member functions
just to add a const version? Ex.:

struct A


 Â Â Â  A & operator = (A const &) { return * this; }

 Â Â Â  A const & operator = (A const &) const { return * this; }


What I would like to suggest would be to templatize those instances as such:

struct A


 Â Â Â  template <qualifier Q>

 Â Â Â      A Q & operator = (A const &) Q { return * this; }


This would in instantiate on-the-fly the 2 (or 4) versions of the same code.

Thank you,

*Phil Bouchard*
C.: (819) 328-4743
Fornux Logo <http://www.fornux.com>

STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups