I was reading standard library documentation and found out that there were some functions like make_tuple. As far as I can see, these functions serve only one purpose: to construct class instance using automatic template argument deduction. Since CTAD was not available before C++17, associated make-functions had to be called. This gap was filled only in C++17. Now I wonder, why it couldn't be implemented earlier "the same way" as function template argument deduction? There should be an example that leads to ambiguity that cannot be resolved before C++17, I guess. Can someone confirm it? What is the difference between functions and classes in that regard? Thank you!
As mentioned in the comments, standardization of a feature takes a long time.
If you wish to know in detail about it, you can check out the section on Standardization from https://isocpp.org, particularly "The life of an ISO proposal: From “cool idea” to “international standard”".
The paper that eventually made CTAD possible in C++17 is titled Template Tidbits and was first published on 2012-09-22.
It underwent many revisions and the paper "Template argument deduction for class templates", which is the sixth revision of the paper was published on 2016-06-24.
So it took about five years for CTAD to go from “cool idea” to “international standard”.
Also as @StoryTeller notes, the idea itself has been around for a much longer time and is presented in the paper Argument Deduction for Constructors which was published in 2007.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With