My solution was implementing template<typename T> class Converter;
, that the user can specialize.
Example:
template<> struct Converter<sf::Color>
{
using T = sf::Color;
inline static void fromObj(T& mValue, const Obj& mObj)
{
mValue.r = as<float>(mObj, 0);
mValue.g = as<float>(mObj, 1);
mValue.b = as<float>(mObj, 2);
mValue.a = as<float>(mObj, 3);
}
inline static void toObj(Obj& mObj, const T& mValue)
{
set(mObj, 0, mValue.r);
set(mObj, 1, mValue.g);
set(mObj, 2, mValue.b);
set(mObj, 3, mValue.a);
}
};