In this post, we will see how to resolve Enabling C++ constructor subject to say std::is_floating_point<T>
Question:I’m trying to enable a default constructor only if the class’s template parameter is floating point. Note
Tis not a parameter type nor return type but the class template type.
std::enable_if_t...= truestuff as an argument to the default constructor (and various other attempts).
Both of these tries rightfully complains about
it1so that’s good, but when I remove that, they both also complain about
it2! I don’t understand and can’t find the magic incantation.
Thanks for any insights.
I forgot to mention, I’m stuck on C++17.
I also tweaked a few things, purely for style.
If you have better answer, please add a comment about this, thank you!