/*+ ARES/HADES/BORG Package -- ./libLSS/tools/string_tools.hpp Copyright (C) 2014-2020 Guilhem Lavaux Copyright (C) 2009-2020 Jens Jasche Additional contributions from: Guilhem Lavaux (2023) +*/ #ifndef __LIBLSS_STRING_TOOLS_HPP #define __LIBLSS_STRING_TOOLS_HPP #include #include #include #include #include #include #include #include "libLSS/tools/is_stl_container.hpp" namespace LibLSS { using std::to_string; template typename std::enable_if::value, std::string>::type to_string(T const &V) { std::ostringstream s; std::copy( V.begin(), V.end(), std::ostream_iterator(s, ",")); return s.str(); } std::vector tokenize(std::string const &in, std::string const &separator); namespace lssfmt { namespace format_detail { static void _format_expansion(boost::format &f) {} template static void _format_expansion(boost::format &f, A &&a, U &&...u) { _format_expansion(f % a, u...); } template std::string format(std::string const &s, U &&...args) { boost::format f(s); _format_expansion(f, std::forward(args)...); return boost::str(f); } } // namespace format_detail using format_detail::format; } // namespace lssfmt /* template std::string to_string(boost::multi_array_ref const& V) { std::ostringstream s; std::copy(V.begin(), V.end(), std::ostream_iterator(s, ",")); return s.str(); }*/ } // namespace LibLSS #endif