41:33 wouldn’t overloading the close_session function just reintroduce the problem which we are trying to solve by using enum classes? Before using enum-> pass the wrong value, underlying type is int-> wrong item gets erased. After using enum + overload -> pass the wrong value, overloaded function gets called, wrong item gets erased, unless we have different implementations for each of the overloaded functions
First solution is a boxing - it's working, for sure, but it have costs, isn't it? Or the compiler can somehow strip away everything except the wrapped string inside the struct?🤔
Yes, with a lot of hoops and tricks you can start reimplementing features of Rust in your C++ code. Or you can just do the logical step and switch to Rust. What the industy is doing anywhay.
The same argument you use for not using std::span also applies to std::pair, and std::tuple these kind of classes lack semantics and indeed should not be used on API's.
41:33 wouldn’t overloading the close_session function just reintroduce the problem which we are trying to solve by using enum classes?
Before using enum-> pass the wrong value, underlying type is int-> wrong item gets erased.
After using enum + overload -> pass the wrong value, overloaded function gets called, wrong item gets erased, unless we have different implementations for each of the overloaded functions
Nice talk.
First solution is a boxing - it's working, for sure, but it have costs, isn't it? Or the compiler can somehow strip away everything except the wrapped string inside the struct?🤔
Is this a reupload? I swear I've seen the jigsaw puzzles before.
Yes, with a lot of hoops and tricks you can start reimplementing features of Rust in your C++ code. Or you can just do the logical step and switch to Rust. What the industy is doing anywhay.
The same argument you use for not using std::span also applies to std::pair, and std::tuple these kind of classes lack semantics and indeed should not be used on API's.