Printing shortest decimal form of floating point number with Mir
jmh530
john.michael.hall at gmail.com
Thu Dec 24 15:00:16 UTC 2020
On Thursday, 24 December 2020 at 09:56:50 UTC, Ola Fosheim
Grøstad wrote:
> [snip]
>
> I don't use concepts yet as it is a very new C++ feature. The
> following code does not work in XCode, although it probably
> should according to cppreference. So take this with a grain of
> salt (other variations should be possible):
>
> namespace detail {
> template<template<typename> typename F, class U>
> constexpr void _is_instantiable(F<U> a){}
> }
>
> template<class T>
> struct Foo{};
>
> template<class T>
> concept Fooish = requires(T a){
> detail::_is_instantiable<Foo>(a);
> };
That Foo-ish reminds me of something in D like
static if (__traits(compiles, {
auto temp = Foo!T.init;
}))
More information about the Digitalmars-d-announce
mailing list