diff options
author | Olivier Gayot <og@satcom1.com> | 2017-11-18 17:21:59 +0100 |
---|---|---|
committer | Olivier Gayot <og@satcom1.com> | 2017-11-19 16:15:32 +0100 |
commit | 615b8a00aedb3363b4749f706d6df51846b743ac (patch) | |
tree | f4b92d89e803a1021204d9bd8a5de49ea39b6d9e /number.h | |
parent | 0916e5446434acd1a3a8384a3e9b1d935f654140 (diff) |
Allow conversion of number to 32 bits integer
The method to_uint32() converts a number to a 32-bits-wide integer. The
function throws if number cannot be represented using only a single
32-bits-wide integer.
Signed-off-by: Olivier Gayot <og@satcom1.com>
Diffstat (limited to 'number.h')
-rw-r--r-- | number.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -26,6 +26,14 @@ public: std::string to_dec_string() const; /** + * \brief Return a 32-bits-wide integer that corresponds to this number. + * + * \throws std::out_of_range The number cannot be represented by a single + * 32-bits-wide integer. + */ + std::uint32_t to_uint32() const; + + /** * \brief Return the result of the addition of a number and this number. * * \param n The number to add to this number. |