stringize.hpp 959 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Copyright (c) 2019-2023 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. #ifndef BOOST_MYSQL_DETAIL_AUXILIAR_STRINGIZE_HPP
  8. #define BOOST_MYSQL_DETAIL_AUXILIAR_STRINGIZE_HPP
  9. #include <sstream>
  10. #include <string>
  11. namespace boost {
  12. namespace mysql {
  13. namespace detail {
  14. inline void stringize_helper(std::ostream&) noexcept {}
  15. template <class T, class... Types>
  16. void stringize_helper(std::ostream& os, const T& input, const Types&... tail)
  17. {
  18. os << input;
  19. stringize_helper(os, tail...);
  20. }
  21. template <class... Types>
  22. std::string stringize(const Types&... inputs)
  23. {
  24. std::ostringstream ss;
  25. stringize_helper(ss, inputs...);
  26. return ss.str();
  27. }
  28. } // namespace detail
  29. } // namespace mysql
  30. } // namespace boost
  31. #endif /* INCLUDE_BOOST_MYSQL_DETAIL_AUXILIAR_STRINGIZE_HPP_ */