github.com/searKing/golang/go@v1.2.117/os/signal/cgo/include/boost/stacktrace/detail/try_dec_convert.hpp (about)

     1  // Copyright Antony Polukhin, 2016-2023.
     2  //
     3  // Distributed under the Boost Software License, Version 1.0. (See
     4  // accompanying file LICENSE_1_0.txt or copy at
     5  // http://www.boost.org/LICENSE_1_0.txt)
     6  
     7  #ifndef BOOST_STACKTRACE_DETAIL_TRY_DEC_CONVERT_HPP
     8  #define BOOST_STACKTRACE_DETAIL_TRY_DEC_CONVERT_HPP
     9  
    10  #include <boost/config.hpp>
    11  #ifdef BOOST_HAS_PRAGMA_ONCE
    12  #   pragma once
    13  #endif
    14  
    15  #include <cstdlib>
    16  
    17  namespace boost { namespace stacktrace { namespace detail {
    18  
    19  // We do not use boost::lexical_cast in this function to reduce module dependencies
    20  inline bool try_dec_convert(const char* s, std::size_t& res) noexcept {
    21      char* end_ptr = 0;
    22      res = std::strtoul(s, &end_ptr, 10);
    23      return *end_ptr == '\0';
    24  }
    25  
    26  
    27  }}} // namespace boost::stacktrace::detail
    28  
    29  #endif // BOOST_STACKTRACE_DETAIL_TRY_DEC_CONVERT_HPP