@ajay9470@madproxy@molecularmusing For a specific implementation it may or may not produce results you want, but as far as the language is concerned, that doesn't actually do anything.
@david_m_stone What is the return type of calls to "bar"? In the general case you need to cast your operands of the comma operator to void, otherwise you can encounter comma operator overloads. Pedantic, but the alternative does not suffer from that.
@molecularmusing That is called type erasure. What you have implemented is most similar to the standard std::move_only_function but without its fallback to the free store when the object doesn't fit locally.
@TrisH0x2A I made it clear they're not expected or required to get through all parts, although 2 or 3 of dozens did. It was only meant to see if they can recognize and assert the limits of their code and where difficulties will arise. Many couldn't do that, which is scary for safety. (2/2)
@TrisH0x2A I used to ask questions during technical interviews related to this, starting simple: write a function to produce the truncated mean of two uint64_t, documenting preconditions if any. Then: remove preconditions, then track the fractional part, then do the same over a range. (1/2)
Russian climbs Everest using ONLY ARMS
Rustam Nabiev, who lost both legs years ago, became the first person in history to climb Mount Everest using only his arms
He proudly raised the Russian flag atop Mount Everest to show that ‘strong people live in Russia’, according to TASS
@Waffl3x Same. Unfortunately, I think the only way people reliably understand contracts is when a language forces them to be explicitly proven. That's where effort should be focused, IMO, but people tend to fear that road. Proof assistants gaining in popularity is a good sign, at least.
RIP Tony Hoare. 😢
I only met him a couple times many years ago at MSR and was not accomplished enough at the time to have much useful to say, but he sure cast a long shadow over the field...
@yutongwu111140 Part of the motivation of generalized non-type-template-params was to avoid variadic chars for strings. You can instead do this with a char array member, a constructor, and ctad to allow for stuff like your_template<"hello">. No variadics required and less heavy for the compiler.
@nicbarkeragain What are you trying to "fix"? In C++ it's UB to read from the inactive member of a union (even if the inactive member is the same type as the active one). You can't read via the int if the bool is active (or neither) and you can't read via the bool if the int is (or neither).