I use mysql-native that return Variant data type. I need to convert it to standard types like int, string etc.
D have std.conv, but std.variant also have methods for concretion.
I can't understand what difference between: get, coerce, toString and to (from std.conv).
Also it's sound very strange that convertsTo is return bool. By it's name I expected that it should do convention. IMHO isConvertable is more proper name for it.
There are three ways to get the value from a
Varianttype:Variant.peek!T: If the value currently being held by theVariantobject is of typeT, then a pointer to that value is returned. If it is holding a value of a different type, it returns null instead.Variant.get!T: If the value currently being held by theVariantobject is of typeT, return the value of it. Otherwise, aVariantExceptionis thrown.Variant.coerce!T: Returns the value currently held by theVariantobject, explicitly convertedto typeT. If the value cannot be converted to typeT, then anExceptionis thrown.