#ifndef OT_UTILITY_UTILITY_HPP_ #define OT_UTILITY_UTILITY_HPP_ #include #include #include #include #include #include // Miscellaneous namespace ot { // Concatnate a string template std::string to_string(Ts&&... ts) { std::ostringstream oss; (oss << ... << ts); return oss.str(); } // Resize a container to fit a given size template void resize_to_fit(size_t N, T& v) { auto sz = v.size(); for(; sz < N; sz = (sz==0) ? 32 : (sz << 1)); v.resize(sz); } // Resize containers to fit a given size template 1), void>* = nullptr> void resize_to_fit(size_t N, T&...vs) { (resize_to_fit(N, vs), ...); } }; #endif