to_string.hpp 846 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef BOOST_QVM_TO_STRING_HPP_INCLUDED
  2. #define BOOST_QVM_TO_STRING_HPP_INCLUDED
  3. /// Copyright (c) 2008-2021 Emil Dotchevski and Reverge Studios, Inc.
  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. #if __cplusplus >= 201103L
  7. #include <string>
  8. namespace boost { namespace qvm {
  9. namespace
  10. qvm_to_string_detail
  11. {
  12. template <class T>
  13. std::string
  14. to_string( T const & x )
  15. {
  16. return std::to_string(x);
  17. }
  18. }
  19. } }
  20. #else
  21. #include <sstream>
  22. namespace boost { namespace qvm {
  23. namespace
  24. qvm_to_string_detail
  25. {
  26. template <class T>
  27. std::string
  28. to_string( T const & x )
  29. {
  30. std::stringstream s;
  31. s << x;
  32. return s.str();
  33. }
  34. }
  35. } }
  36. #endif
  37. #endif