123456789101112131415161718192021222324252627282930313233343536373839 |
- #ifndef BOOST_MP_DETAIL_ITOS_HPP
- #define BOOST_MP_DETAIL_ITOS_HPP
- namespace boost { namespace multiprecision { namespace detail {
- template <class Integer>
- std::string itos(Integer val)
- {
- if (!val) return "0";
- std::string result;
- bool isneg = false;
- if (val < 0)
- {
- val = -val;
- isneg = true;
- }
- while (val)
- {
- result.insert(result.begin(), char('0' + (val % 10)));
- val /= 10;
- }
- if (isneg)
- result.insert(result.begin(), '-');
- return result;
- }
- }}}
- #endif
|