[libcxx-commits] [PATCH] D97365: [libc++] [C++2b] [P1682] Add to_underlying.
Marek Kurdej via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 4 23:48:42 PST 2021
curdeius added inline comments.
================
Comment at: libcxx/include/utility:1635
+__to_underlying(_Tp __val) noexcept {
+ return static_cast<underlying_type_t<_Tp> >(__val);
+}
----------------
ldionne wrote:
> Quuxplusone wrote:
> > Mordante wrote:
> > > Since we also use bitmask types in C++11, would it be possible to make this available in C++11? `std::underlying_type` is available in C++11.
> > Your friendly neighborhood ADL-hater says: `_VSTD::__to_underlying`
> Just to be clear, we don't provide new features in older standard modes. It's fine to expose `__to_underlying` pre C++2b so you can use it to implement other stuff, but it has to come at no significant additional cost (OK here). But we *do not* expose `std::to_underlying` pre C++2b -- not sure which one you were asking about.
Yes, the idea was to expose `__to_underlying ` (but not `std::to_underlying`) in pre C++2b, so that it can be used for bitmask types.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97365/new/
https://reviews.llvm.org/D97365
More information about the libcxx-commits
mailing list