#ifndef LIBCUBESCRIPT_CS_UTIL_HH #define LIBCUBESCRIPT_CS_UTIL_HH #include #include #include namespace cscript { template using CsMap = ostd::Map; template using CsVector = std::vector; CsInt cs_parse_int( ostd::ConstCharRange input, ostd::ConstCharRange *end = nullptr ); CsFloat cs_parse_float( ostd::ConstCharRange input, ostd::ConstCharRange *end = nullptr ); template struct CsScopeExit { template CsScopeExit(FF &&f): func(std::forward(f)) {} ~CsScopeExit() { func(); } ostd::Decay func; }; template inline void cs_do_and_cleanup(F1 &&dof, F2 &&clf) { CsScopeExit cleanup(std::forward(clf)); dof(); } } /* namespace cscript */ #endif /* LIBCUBESCRIPT_CS_UTIL_HH */