7 ms·
In C++ one could use strong types (template phantom types with anonymous tags) to distinguish between source and destination. I use this technic to disambiguat
by rq1 7y ago
In C++ one could use strong types (template phantom types with anonymous tags) to distinguish between source and destination.
I use this technic to disambiguate all kind of types (source/destination gpu/cpu pointers for instance) and correctly dispatch everything at compile time.
The compiler becomes your best friend then. :)
- archi42 7y agoThat's a nice idea. Also, while I love C++, I'm really frustrated that there are no native named arguments :( However, after your comment, I decided to spend a few minutes on the topic, and came up with these links: https://www.fluentcpp.com/2016/12/08/strong-types-for-strong-interfaces/ https://www.fluentcpp.com/2016/12/08/strong-types-for-strong... https://www.fluentcpp.com/2018/12/14/named-arguments-cpp/ https://www.fluentcpp.com/2018/12/14/named-arguments-cpp/ I am now looking forward to refactor some of our code base to make use of this. Awesome and thanks for the nudge!