RFR: 8251274: Provide utility types for function SFINAE using extra template parameters
Kim Barrett
kim.barrett at oracle.com
Mon Aug 31 08:43:03 UTC 2020
> On Aug 28, 2020, at 3:46 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
> I think that macro is okay. I would be even happier with it if we had
> variable templates for the type traits, a la C++17, so
>
> std::is_integral<T>::value => std::is_integral_v<T>
>
> We could add a suite of IsIntegralV &etc variable templates.
Though I think I’d rather not provide them that way.
> Alternatively,
> I wonder how much trouble we might be taking on if we conditionally defined
> them with something like
>
> #if __cplusplus == 201402L
> namespace std {
> template<typename T> constexpr bool is_integral_v = std::is_integral<T>::value;
> ...
> }
> #endif // __cplusplus
I think adding them this way is worth considering, though not part of *this* change.
> (Note that we can't get *exactly* the behavior of C++17 for these, since
> inline variables are a C++17 language feature. The difference is linkage,
> but I don't expect anyone to care whether `&IsIntegralV<int>` in different
> translation units result in the same address.)
More information about the hotspot-dev
mailing list