Re:CppCon 2018: Simplicity: Not Just For Beginners [video]
by beached_whale on Friday September 28, 2018 @11:10PM
(#18098514)
I should say, I mean the overload has already been found at that point.
Re:CppCon 2018: Simplicity: Not Just For Beginners [video]
by pjmlp on Saturday September 29, 2018 @06:39AM
(#18099674)
Thanks for the correction, I was simplifying, without going into enable_if details and such.
Re:CppCon 2018: Simplicity: Not Just For Beginners [video]
by beached_whale on Saturday September 29, 2018 @11:47AM
(#18101009)
enable_if is ugly. But a lot of the extra ugliness is people putting everything into the condition and not abstracting the parts of it into other traits. Just like looking at long functions.
One thing to remember though is that there are two things at play here. The library writers tools, like TMP, and the users. The users can do a lot and never worry about SFINAE/tag dispatch. The library writers use it to allow the users of the library to have a potentially very simple experience.
Also, Greenfield C++ can be way different than pre 2011 C++. The cost of things that people would work around has gone way done to zero in some cases. Like returning a value from a function is like constructing it in place at the caller. So that takes away a need to use the heap to allocate it or to copy it when you return it.