Subject: Re: [std-proposals] std::underlying_value
From: Arthur O'Dwyer (arthur.j.odwyer_at_[hidden])
Date: 2019-10-20 10:50:26
Re P1682R1 "std::to_underlying for enumerations":
One thing to be aware of here is ADL.
The Standard Library has historically been at least a tiny bit careful
(though not as careful as I'd prefer) to avoid adding "greedy" templates
that collide with plausible user names.
See https://quuxplusone.github.io/blog/2018/11/04/std-hash-value/ for more
However, in the specific case of functions taking only enum types, I think
you're in the clear -- because the associated namespaces for nested enum
types do *not* include the kitchen sink! For example, A<B>::E is associated
only with A, never with B or even with the base classes of A.
Here's my most valiant effort to make ADL break your proposal... and my
effort failed: https://godbolt.org/z/8_Rix-
STD-PROPOSALS list run by email@example.com
Standard Proposals Archives on Google Groups