#ifndef LIBCUBESCRIPT_CS_UTIL_HH #define LIBCUBESCRIPT_CS_UTIL_HH #include #include #include namespace cscript { template using cs_map = std::unordered_map; template using cs_vector = std::vector; cs_int cs_parse_int( ostd::string_range input, ostd::string_range *end = nullptr ); cs_float cs_parse_float( ostd::string_range input, ostd::string_range *end = nullptr ); template struct CsScopeExit { template CsScopeExit(FF &&f): func(std::forward(f)) {} ~CsScopeExit() { func(); } std::decay_t 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 */