Saturday 28 September 2019

C++ craftsman named arguments

We try to compensate for lack on named arguments in so many ways. Check one the lastest takes on a subject: https://www.youtube.com/watch?v=Grveezn0zhUCppCon 2018: Richard Powell “Named Arguments from Scratch”. The recent C++20 "designated initialization" doesn't help much, as you must remember the order of fields as declared in a corresponding struct. Other people try things around it, as well, such as calling functions using curly syntax: https://www.youtube.com/watch?v=L8eeDzTWEtU, or allowing default parameters in the middle of args list https://github.com/joboccara/Defaulted. So, there's a lot, and more: https://www.codeproject.com/Articles/1171605/Named-Cpp-Function-Parameters , https://www.fluentcpp.com/2018/12/14/named-arguments-cpp/ etc.

But let's pull back. What if: