append_int.hpp 646 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef BOOST_SYSTEM_DETAIL_APPEND_INT_HPP_INCLUDED
  2. #define BOOST_SYSTEM_DETAIL_APPEND_INT_HPP_INCLUDED
  3. // Copyright 2021 Peter Dimov
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/system/detail/snprintf.hpp>
  7. #include <string>
  8. //
  9. namespace boost
  10. {
  11. namespace system
  12. {
  13. namespace detail
  14. {
  15. inline void append_int( std::string& s, int v )
  16. {
  17. char buffer[ 32 ];
  18. detail::snprintf( buffer, sizeof( buffer ), ":%d", v );
  19. s += buffer;
  20. }
  21. } // namespace detail
  22. } // namespace system
  23. } // namespace boost
  24. #endif // #ifndef BOOST_SYSTEM_DETAIL_APPEND_INT_HPP_INCLUDED