Very occasionally, I stumble across a rare logic condition: a 3-way (or even n-way) XOR. There might be a better name for it, but it essentially is this problem: You want a condition with to be true iff of variables A, B, C, … only one is true.
Designing a C++ API, I came across an interesting problem lately. A member function was returning a pointer a newly created object and it wasn’t apparent (without reading the documentation) if the returned pointer was still managed by the creator class or not. I figured there should be an easy way to tell the API […]