Make the C++ Value API a little less error prone

Yesterday I ended up accidentally constructing a Value with a string literal
and that turned into a boolean value, resulting in run-time panic.
A deleted `const void *` constructor prevents this by producing a compile error instead of
picking the boolean constructor.
This commit is contained in:
Simon Hausmann 2021-03-26 09:55:13 +01:00
parent 4fd4ac0754
commit 10189a844c

View file

@ -376,6 +376,7 @@ public:
}
private:
inline Value(const void *) = delete; // Avoid that for example Value("foo") turns to Value(bool)
using ValueOpaque = sixtyfps::cbindgen_private::ValueOpaque;
ValueOpaque inner;
friend struct Struct;