diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index a4c7fa470..e2049cd32 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -16,6 +16,13 @@ public: void write_ini(const std::string& file) { save(file); } void read_ini(const std::string& file) { load(file); } + + /// Template function to retrieve and cast in hopefully a slightly nicer + /// format than longwinded dynamic_cast<> + template + T& get(const t_config_option_key& opt_key, bool create=false) { + return *(dynamic_cast(this->optptr(opt_key, create))); + } }; } // namespace Slic3r