#ifndef LIBCUBESCRIPT_CS_UTIL_HH #define LIBCUBESCRIPT_CS_UTIL_HH #include #include #include namespace cscript { 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(ostd::forward(f)) {} ~CsScopeExit() { func(); } ostd::Decay func; }; template inline void cs_do_and_cleanup(F1 &&dof, F2 &&clf) { CsScopeExit cleanup(ostd::forward(clf)); dof(); } } /* namespace cscript */ #endif /* LIBCUBESCRIPT_CS_UTIL_HH */