MCPcopy Create free account
hub / github.com/boostorg/stacktrace / to_dec_array

Function to_dec_array

include/boost/stacktrace/detail/to_dec_array.hpp:21–42  ·  view source on GitHub ↗

We do not use boost::lexical_cast in this function to reduce module dependencies

Source from the content-addressed store, hash-verified

19
20// We do not use boost::lexical_cast in this function to reduce module dependencies
21inline std::array<char, 40> to_dec_array(std::size_t value) noexcept {
22 std::array<char, 40> ret;
23 if (!value) {
24 ret[0] = '0';
25 ret[1] = '\0';
26 return ret;
27 }
28
29 std::size_t digits = 0;
30 for (std::size_t value_copy = value; value_copy; value_copy /= 10) {
31 ++ digits;
32 }
33
34 for (std::size_t i = 1; i <= digits; ++i) {
35 ret[digits - i] = static_cast<char>('0' + (value % 10));
36 value /= 10;
37 }
38
39 ret[digits] = '\0';
40
41 return ret;
42}
43
44
45}}} // namespace boost::stacktrace::detail

Callers 2

test_to_dec_arrayFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_to_dec_arrayFunction · 0.68