-2

I have been dreaming for years about dyadic operators min and max similar to other arithmetic operators.

E.g.

int a, b, c;
cout << (a min b) max c;

As well as the corresponding assignment operators,

a min= b;

How can I lobby to obtain this in a future version ?

Possible notation could be \/ and /\, but I have no strong requirement about this :-)

The question is not about set and ranges, but numerical types.

JJJ
  • 32,902
  • 20
  • 89
  • 102
  • 2
    It's worth noting that GCC has/had these as an extension: https://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/Min-and-Max.html. In addition, you can get close to the first code with a named operator implementation. I want to say this was discussed on std-proposals as well, but I can't find it. – chris Jun 07 '18 at 17:52
  • 1
    Easy to make as, say `a *min* b`, check Yakk answer in the link I provided – Severin Pappadeux Jun 07 '18 at 17:54
  • 1
    The question about how to encourage the standards committee to adopt it isn't really on-topic here, which is supposed to be about actual programming questions. – Barmar Jun 07 '18 at 17:55
  • 1
    Possible duplicate of [Does boost have a datatype for set operations that is simpler than the STL?](https://stackoverflow.com/questions/15090209/does-boost-have-a-datatype-for-set-operations-that-is-simpler-than-the-stl) – Severin Pappadeux Jun 07 '18 at 17:57
  • @Barmar: of course not, but I have no idea where to ask. –  Jun 07 '18 at 18:01
  • Catch-22: Asking where to ask would also be off-topic. :) – Barmar Jun 07 '18 at 18:02
  • @chris: a step in the right direction, thanks. The assignments `>?=` and `=` would even be more useful. –  Jun 07 '18 at 18:05
  • Google WG21.... – rustyx Jun 07 '18 at 18:09
  • Proposal exists for letting you write *any* binary function as infix, that is, `a.min(b)` becomes equivalent to `min(a,b)` even though `min` is not a member of `decltype(a)`. https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax – Ben Voigt Jun 07 '18 at 18:30
  • @rustyx: that's what I was looking for. You can enter this as an answer (though indeed not the right site for this topic). –  Jun 07 '18 at 18:46

1 Answers1

2

There's the ISO working group 21 who decide what goes into the ISO C++ standard and what doesn't.

And here's the process of submitting a proposal to WG21.

It begins with participating in the mailings of the working group and getting on the agenda of an upcoming meeting to discuss your idea. It's actually possible, but it takes a lot of effort.

rustyx
  • 80,671
  • 25
  • 200
  • 267