cat.hpp 807 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2015-2017 Hans Dembinski
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt
  5. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_HISTOGRAM_DETAIL_CAT_HPP
  7. #define BOOST_HISTOGRAM_DETAIL_CAT_HPP
  8. #include <boost/config.hpp>
  9. #include <sstream>
  10. namespace boost {
  11. namespace histogram {
  12. namespace detail {
  13. BOOST_ATTRIBUTE_UNUSED inline void cat_impl(std::ostringstream&) {}
  14. template <typename T, typename... Ts>
  15. void cat_impl(std::ostringstream& os, const T& t, const Ts&... ts) {
  16. os << t;
  17. cat_impl(os, ts...);
  18. }
  19. template <typename... Ts>
  20. std::string cat(const Ts&... args) {
  21. std::ostringstream os;
  22. cat_impl(os, args...);
  23. return os.str();
  24. }
  25. } // namespace detail
  26. } // namespace histogram
  27. } // namespace boost
  28. #endif