Trivia impact: none
The Type You Can Call
a type trait that behaves like a nullary function
Can a temporary type trait be called with parentheses?
Why¶
std::true_type is an alias for an std::integral_constant specialization.
[meta.help] gives integral_constant both a conversion operator and a nullary
operator() returning value. The callable spelling has been present since C++14, so it
is ordinary C++17 rather than a compiler extension.
Where it shows up¶
Almost nowhere on purpose. Older template-metaprogramming code may use it where a
callable predicate is convenient, but reading ::value is usually clearer.
Takeaway: An std::integral_constant specialization supplies a value and a nullary callable.
Try it: g++ -std=c++17 main.cpp -o demo && ./demo