diff --git a/lib/jsonserializable.h b/lib/jsonserializable.h index f20cf01..3850351 100644 --- a/lib/jsonserializable.h +++ b/lib/jsonserializable.h @@ -81,6 +81,23 @@ template Type JSONSerializable::fromJson(const std::string return Reflector::fromJson(json.data(), json.size()); } +/*! + * \brief Helps to disambiguate when inheritance is used. + */ +template , Type>>...> JSONSerializable &as(Type &serializable) +{ + return static_cast &>(serializable); +} + +/*! + * \brief Helps to disambiguate when inheritance is used. + */ +template , Type>>...> +const JSONSerializable &as(const Type &serializable) +{ + return static_cast &>(serializable); +} + } // namespace ReflectiveRapidJSON #endif // REFLECTIVE_RAPIDJSON_JSON_SERIALIZABLE_H