From 4729d31bf214a4fb331af48ac86ada11109783be Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Wed, 26 Oct 2011 15:57:31 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=82=92=E6=A8=99=E6=BA=96=E4=BE=8B=E5=A4=96=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sprout/algorithm/fixed/shuffle.hpp | 2 +- sprout/detail/integer.hpp | 4 ++-- sprout/detail/integer/integer_mask.hpp | 16 +++++++-------- sprout/iterator/next.hpp | 2 +- sprout/iterator/value_iterator.hpp | 5 +++-- sprout/math/factorial.hpp | 3 ++- sprout/random/bernoulli_distribution.hpp | 3 ++- sprout/random/binomial_distribution.hpp | 3 ++- sprout/random/detail/const_mod.hpp | 12 ++++++----- sprout/random/geometric_distribution.hpp | 3 ++- sprout/random/inversive_congruential.hpp | 3 ++- sprout/random/linear_congruential.hpp | 3 ++- sprout/random/normal_distribution.hpp | 3 ++- sprout/random/random_iterator.hpp | 12 +++++------ sprout/random/shuffle_order.hpp | 4 +++- sprout/random/uniform_int_distribution.hpp | 3 ++- sprout/random/uniform_real_distribution.hpp | 11 ++++++----- sprout/random/uniform_smallint.hpp | 3 ++- sprout/string.hpp | 22 ++++++++++----------- sprout/uuid/name_generator.hpp | 2 +- sprout/uuid/string_generator.hpp | 12 +++++++---- sprout/uuid/uuid.hpp | 2 +- 22 files changed, 76 insertions(+), 57 deletions(-) diff --git a/sprout/algorithm/fixed/shuffle.hpp b/sprout/algorithm/fixed/shuffle.hpp index 75261f41..db9f4680 100644 --- a/sprout/algorithm/fixed/shuffle.hpp +++ b/sprout/algorithm/fixed/shuffle.hpp @@ -43,7 +43,7 @@ namespace sprout { UniformRandomNumberGenerator&& g ) { - + return n > 0 ? sprout::fixed::detail::make_shuffle_indexes_1( n, diff --git a/sprout/detail/integer.hpp b/sprout/detail/integer.hpp index 3630d156..3ed939ac 100644 --- a/sprout/detail/integer.hpp +++ b/sprout/detail/integer.hpp @@ -8,8 +8,8 @@ namespace sprout { namespace detail { template - struct int_fast_t { - typedef LeastInt fast; + struct int_fast_t { + typedef LeastInt fast; typedef fast type; }; diff --git a/sprout/detail/integer/integer_mask.hpp b/sprout/detail/integer/integer_mask.hpp index 2a8487de..cd222cf6 100644 --- a/sprout/detail/integer/integer_mask.hpp +++ b/sprout/detail/integer/integer_mask.hpp @@ -12,8 +12,8 @@ namespace sprout { template struct high_bit_mask_t { public: - typedef typename sprout::detail::uint_t<(Bits + 1)>::least least; - typedef typename sprout::detail::uint_t<(Bits + 1)>::fast fast; + typedef typename sprout::detail::uint_t<(Bits + 1)>::least least; + typedef typename sprout::detail::uint_t<(Bits + 1)>::fast fast; public: SPROUT_STATIC_CONSTEXPR least high_bit = least(1u) << Bits; SPROUT_STATIC_CONSTEXPR fast high_bit_fast = fast(1u) << Bits; @@ -23,8 +23,8 @@ namespace sprout { template struct low_bits_mask_t { public: - typedef typename sprout::detail::uint_t::least least; - typedef typename sprout::detail::uint_t::fast fast; + typedef typename sprout::detail::uint_t::least least; + typedef typename sprout::detail::uint_t::fast fast; public: SPROUT_STATIC_CONSTEXPR least sig_bits = ~(~(least(0u)) << Bits); SPROUT_STATIC_CONSTEXPR fast sig_bits_fast = fast(sig_bits); @@ -35,9 +35,9 @@ namespace sprout { template<> \ struct low_bits_mask_t::digits> { \ public: \ - typedef std::numeric_limits limits_type; \ - typedef typename sprout::detail::uint_t::least least; \ - typedef typename sprout::detail::uint_t::fast fast; \ + typedef std::numeric_limits limits_type; \ + typedef typename sprout::detail::uint_t::least least; \ + typedef typename sprout::detail::uint_t::fast fast; \ public: \ SPROUT_STATIC_CONSTEXPR least sig_bits = ~(least(0u)); \ SPROUT_STATIC_CONSTEXPR fast sig_bits_fast = fast(sig_bits); \ @@ -55,7 +55,7 @@ namespace sprout { SPROUT_LOW_BITS_MASK_SPECIALIZE(unsigned long); #endif #if ULLONG_MAX > ULONG_MAX - SPROUT_LOW_BITS_MASK_SPECIALIZE(unsigned long long); + SPROUT_LOW_BITS_MASK_SPECIALIZE(unsigned long long); #endif #undef SPROUT_LOW_BITS_MASK_SPECIALIZE diff --git a/sprout/iterator/next.hpp b/sprout/iterator/next.hpp index a031f9b9..9699a409 100644 --- a/sprout/iterator/next.hpp +++ b/sprout/iterator/next.hpp @@ -1,6 +1,6 @@ #ifndef SPROUT_ITERATOR_NEXT_HPP #define SPROUT_ITERATOR_NEXT_HPP - + #include #include #include diff --git a/sprout/iterator/value_iterator.hpp b/sprout/iterator/value_iterator.hpp index a18b95b2..aa4858fe 100644 --- a/sprout/iterator/value_iterator.hpp +++ b/sprout/iterator/value_iterator.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -99,13 +100,13 @@ namespace sprout { SPROUT_CONSTEXPR reference operator*() const { return count_ != 0 ? holder_.get() - : (throw "assert(count_ != 0)", holder_.get()) + : (throw std::out_of_range("value_iterator<>: dereference at out of range"), holder_.get()) ; } SPROUT_CONSTEXPR pointer operator->() const { return count_ != 0 ? holder_.get_pointer() - : throw "assert(count_ != 0)" + : throw std::out_of_range("value_iterator<>: dereference at out of range") ; } value_iterator& operator++() { diff --git a/sprout/math/factorial.hpp b/sprout/math/factorial.hpp index 5fa0790e..f86aee9d 100644 --- a/sprout/math/factorial.hpp +++ b/sprout/math/factorial.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -634,7 +635,7 @@ namespace sprout { SPROUT_CONSTEXPR T factorial(std::size_t x) { return x <= sprout::math::detail::factorials::limit ? sprout::math::detail::factorials::table[x] - : throw "assert(x <= sprout::math::detail::factorials::limit)" + : throw std::invalid_argument("factorial(): argument limit exceeded") ; } } // namespace math diff --git a/sprout/random/bernoulli_distribution.hpp b/sprout/random/bernoulli_distribution.hpp index d819822b..051feba0 100644 --- a/sprout/random/bernoulli_distribution.hpp +++ b/sprout/random/bernoulli_distribution.hpp @@ -2,6 +2,7 @@ #define SPROUT_RANDOM_BERNOULLI_DISTRIBUTION_HPP #include +#include #include #include @@ -22,7 +23,7 @@ namespace sprout { static SPROUT_CONSTEXPR RealType arg_check(RealType p_arg) { return arg_check_nothrow(p_arg) ? p_arg - : throw "assert(p_arg >= 0 && p_arg <= 1)" + : throw std::invalid_argument("bernoulli_distribution<>: invalid argument (p_arg >= 0 && p_arg <= 1)") ; } public: diff --git a/sprout/random/binomial_distribution.hpp b/sprout/random/binomial_distribution.hpp index 925c2b89..e5843bc5 100644 --- a/sprout/random/binomial_distribution.hpp +++ b/sprout/random/binomial_distribution.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,7 @@ namespace sprout { static SPROUT_CONSTEXPR IntType arg_check(IntType t_arg, RealType p_arg) { return arg_check_nothrow(t_arg, p_arg) ? t_arg - : throw "assert(t_arg >= IntType(0) && RealType(0) <= p_arg && p_arg <= RealType(1))" + : throw std::invalid_argument("binomial_distribution<>: invalid argument (t_arg >= 0 && 0 <= p_arg && p_arg <= 1)") ; } public: diff --git a/sprout/random/detail/const_mod.hpp b/sprout/random/detail/const_mod.hpp index a36b6ce0..e807fbf7 100644 --- a/sprout/random/detail/const_mod.hpp +++ b/sprout/random/detail/const_mod.hpp @@ -2,6 +2,7 @@ #define SPROUT_RANDOM_DETAIL_CONST_MOD_HPP #include +#include #include #include @@ -31,7 +32,7 @@ namespace sprout { static SPROUT_CONSTEXPR IntType mult_schrage_1(IntType a, IntType value, IntType q, IntType r) { return r < q ? sub(a * (value % q), r * (value / q)) - : throw "assert(r < q)" + : throw std::domain_error("const_mod<>: domain error (r < q)") ; } static SPROUT_CONSTEXPR IntType mult_schrage(IntType a, IntType value) { @@ -40,7 +41,8 @@ namespace sprout { static SPROUT_CONSTEXPR IntType mult_general(IntType a, IntType b) { return std::uintmax_t(modulus) <= std::numeric_limits::max() / modulus ? static_cast(std::uintmax_t(a) * b % modulus) - : /*static_cast(sprout::random::detail::mulmod(a, b, modulus))*/throw "Sorry, not implemented." + //: static_cast(sprout::random::detail::mulmod(a, b, modulus)) // ??? + : throw std::domain_error("const_mod<>: Sorry, not implemented.") ; } static SPROUT_CONSTEXPR IntType sub(IntType a, IntType b) { @@ -61,7 +63,7 @@ namespace sprout { static SPROUT_CONSTEXPR IntType invert_euclidian(IntType c) { return c > 0 ? c == 1 ? 1 : invert_euclidian_1(c, 0, 1, c, m) - : throw "assert(c > 0)" + : throw std::domain_error("const_mod<>: domain error (c > 0)") ; } static SPROUT_CONSTEXPR IntType invert_euclidian0_3(IntType c, IntType l1, IntType l2, IntType n, IntType p) { @@ -73,13 +75,13 @@ namespace sprout { static SPROUT_CONSTEXPR IntType invert_euclidian0_1(IntType c, IntType l1, IntType l2, IntType n, IntType p) { return std::numeric_limits::max() % n != n - 1 ? invert_euclidian0_2(c, l1 + (std::numeric_limits::max() / n) * l2, l2, n, std::numeric_limits::max() - (std::numeric_limits::max() / n) * n + 1) - : throw "assert(std::numeric_limits::max() % n != n - 1)" + : throw std::domain_error("const_mod<>: domain error (numeric_limits::max() % n != n - 1)") ; } static SPROUT_CONSTEXPR IntType invert_euclidian0(IntType c) { return c > 0 ? c == 1 ? 1 : invert_euclidian0_1(c, 0, 1, c, m) - : throw "assert(c > 0)" + : throw std::domain_error("const_mod<>: domain error (c > 0)") ; } public: diff --git a/sprout/random/geometric_distribution.hpp b/sprout/random/geometric_distribution.hpp index ffe5467f..39951fdf 100644 --- a/sprout/random/geometric_distribution.hpp +++ b/sprout/random/geometric_distribution.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,7 @@ namespace sprout { static SPROUT_CONSTEXPR RealType arg_check(RealType p_arg) { return arg_check_nothrow(p_arg) ? p_arg - : throw "assert(RealType(0) < p_arg && p_arg < RealType(1))" + : throw std::invalid_argument("geometric_distribution<>: invalid argument (0 < p_arg && p_arg < 1)") ; } public: diff --git a/sprout/random/inversive_congruential.hpp b/sprout/random/inversive_congruential.hpp index 139231bb..380dd774 100644 --- a/sprout/random/inversive_congruential.hpp +++ b/sprout/random/inversive_congruential.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,7 @@ namespace sprout { static SPROUT_CONSTEXPR IntType arg_check(IntType const& x0) { return arg_check_nothrow(x0) ? x0 - : throw "assert(x0 >= static_min() && x0 <= static_max())" + : throw std::invalid_argument("inversive_congruential_engine<>: invalid argument (x0 >= static_min() && x0 <= static_max())") ; } static SPROUT_CONSTEXPR IntType init_seed_2(IntType const& x0) { diff --git a/sprout/random/linear_congruential.hpp b/sprout/random/linear_congruential.hpp index eb875f13..e51804c1 100644 --- a/sprout/random/linear_congruential.hpp +++ b/sprout/random/linear_congruential.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -41,7 +42,7 @@ namespace sprout { static SPROUT_CONSTEXPR IntType arg_check(IntType const& x0) { return arg_check_nothrow(x0) ? x0 - : throw "assert(x0 >= static_min() && x0 <= static_max())" + : throw std::invalid_argument("linear_congruential_engine<>: invalid argument (x0 >= static_min() && x0 <= static_max())") ; } static SPROUT_CONSTEXPR IntType init_seed_2(IntType const& x0) { diff --git a/sprout/random/normal_distribution.hpp b/sprout/random/normal_distribution.hpp index 0041267d..61b7ec23 100644 --- a/sprout/random/normal_distribution.hpp +++ b/sprout/random/normal_distribution.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,7 @@ namespace sprout { static SPROUT_CONSTEXPR RealType arg_check(RealType mean_arg, RealType sigma_arg) { return arg_check_nothrow(mean_arg, sigma_arg) ? mean_arg - : throw "assert(sigma_arg >= RealType(0))" + : throw std::invalid_argument("normal_distribution<>: invalid argument (sigma_arg >= 0)") ; } public: diff --git a/sprout/random/random_iterator.hpp b/sprout/random/random_iterator.hpp index bb04c823..481ba65b 100644 --- a/sprout/random/random_iterator.hpp +++ b/sprout/random/random_iterator.hpp @@ -69,7 +69,7 @@ namespace sprout { SPROUT_CONSTEXPR random_iterator operator()() const { return count_ != 0 ? random_iterator(random_(), count_ > 0 ? count_ - 1 : count_) - : throw "assert(count_ != 0)" + : throw std::out_of_range("random_iterator<>: increment at out of range") ; } random_result_type& random_result() { @@ -119,13 +119,13 @@ namespace sprout { SPROUT_CONSTEXPR reference operator*() const { return count_ != 0 ? random_.result() - : (throw "assert(count_ != 0)", random_.result()) + : (throw std::out_of_range("random_iterator<>: dereference at out of range"), random_.result()) ; } SPROUT_CONSTEXPR pointer operator->() const { return count_ != 0 ? &random_.result() - : throw "assert(count_ != 0)" + : throw std::out_of_range("random_iterator<>: dereference at out of range") ; } random_iterator& operator++() { @@ -188,7 +188,7 @@ namespace sprout { SPROUT_CONSTEXPR random_iterator operator()() const { return count_ != 0 ? random_iterator(random_(), count_ > 0 ? count_ - 1 : count_) - : throw "assert(count_ != 0)" + : throw std::out_of_range("random_iterator<>: increment at out of range") ; } random_result_type& random_result() { @@ -232,13 +232,13 @@ namespace sprout { SPROUT_CONSTEXPR reference operator*() const { return count_ != 0 ? random_.result() - : (throw "assert(count_ != 0)", random_.result()) + : (throw std::out_of_range("random_iterator<>: dereference at out of range"), random_.result()) ; } SPROUT_CONSTEXPR pointer operator->() const { return count_ > 0 ? &random_.result() - : throw "assert(count_ != 0)" + : throw std::out_of_range("random_iterator<>: dereference at out of range") ; } random_iterator& operator++() { diff --git a/sprout/random/shuffle_order.hpp b/sprout/random/shuffle_order.hpp index 55374e91..373b9433 100644 --- a/sprout/random/shuffle_order.hpp +++ b/sprout/random/shuffle_order.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -102,7 +103,8 @@ namespace sprout { k == 1 ? BaseUnsigned(0) : brange < std::numeric_limits::max() / k ? BaseUnsigned(k * off / (brange + 1)) : brange < std::numeric_limits::max() / k ? static_cast(static_cast(off) * k / (static_cast(brange) + 1)) - : /*static_cast(sprout::random::detail::muldiv(off, k, static_cast(brange) + 1))*/throw "Sorry, not implemented." + //: static_cast(sprout::random::detail::muldiv(off, k, static_cast(brange) + 1)) // ??? + : throw std::domain_error("shuffle_order_engine<>: Sorry, not implemented.") ); } public: diff --git a/sprout/random/uniform_int_distribution.hpp b/sprout/random/uniform_int_distribution.hpp index 02c0deb5..737b58d0 100644 --- a/sprout/random/uniform_int_distribution.hpp +++ b/sprout/random/uniform_int_distribution.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -396,7 +397,7 @@ namespace sprout { static SPROUT_CONSTEXPR IntType arg_check(IntType min_arg, IntType max_arg) { return arg_check_nothrow(min_arg, max_arg) ? min_arg - : throw "assert(min_arg <= max_arg)" + : throw std::invalid_argument("uniform_int_distribution<>: invalid argument (min_arg <= max_arg)") ; } public: diff --git a/sprout/random/uniform_real_distribution.hpp b/sprout/random/uniform_real_distribution.hpp index 45e5bbd3..37c151ec 100644 --- a/sprout/random/uniform_real_distribution.hpp +++ b/sprout/random/uniform_real_distribution.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -54,8 +55,8 @@ namespace sprout { max_value, numerator / divisor * (max_value - min_value) + min_value ) - : throw "assert(numerator >= 0 && numerator <= divisor)" - : throw "assert(divisor > 0)" + : throw std::domain_error("generate_uniform_real(): domain error (numerator >= 0 && numerator <= divisor)") + : throw std::domain_error("generate_uniform_real(): domain error (divisor > 0)") ; } template @@ -123,8 +124,8 @@ namespace sprout { max_value, numerator / divisor * (max_value - min_value) + min_value ) - : throw "assert(numerator >= 0 && numerator <= divisor)" - : throw "assert(divisor > 0)" + : throw std::domain_error("generate_uniform_real(): domain error (numerator >= 0 && numerator <= divisor)") + : throw std::domain_error("generate_uniform_real(): domain error (divisor > 0)") ; } template @@ -188,7 +189,7 @@ namespace sprout { static SPROUT_CONSTEXPR RealType arg_check(RealType min_arg, RealType max_arg) { return arg_check_nothrow(min_arg, max_arg) ? min_arg - : throw "assert(min_arg <= max_arg)" + : throw std::invalid_argument("uniform_real_distribution<>: invalid argument (min_arg <= max_arg)") ; } public: diff --git a/sprout/random/uniform_smallint.hpp b/sprout/random/uniform_smallint.hpp index 867b2d56..7035730a 100644 --- a/sprout/random/uniform_smallint.hpp +++ b/sprout/random/uniform_smallint.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -26,7 +27,7 @@ namespace sprout { static SPROUT_CONSTEXPR IntType arg_check(IntType min_arg, IntType max_arg) { return arg_check_nothrow(min_arg, max_arg) ? min_arg - : throw "assert(min_arg <= max_arg)" + : throw std::invalid_argument("uniform_smallint<>: invalid argument (min_arg <= max_arg)") ; } public: diff --git a/sprout/string.hpp b/sprout/string.hpp index a3a1c2c5..a0b9ecae 100644 --- a/sprout/string.hpp +++ b/sprout/string.hpp @@ -54,9 +54,9 @@ namespace sprout { ; } static SPROUT_CONSTEXPR std::size_t length(char_type const* s) { - return !*s ? 0 - : 1 + length(s + 1) - ; + return !*s ? 0 + : 1 + length(s + 1) + ; } static SPROUT_CONSTEXPR char_type const* find(char_type const* s, std::size_t n, char_type const& a) { return !n ? nullptr @@ -115,9 +115,9 @@ namespace sprout { } template static SPROUT_CONSTEXPR std::size_t length(ConstIterator s) { - return !*s ? 0 - : 1 + length(s + 1) - ; + return !*s ? 0 + : 1 + length(s + 1) + ; } template static SPROUT_CONSTEXPR ConstIterator find(ConstIterator s, std::size_t n, char_type const& a) { @@ -257,7 +257,7 @@ namespace sprout { static SPROUT_CONSTEXPR basic_string from_c_str(value_type const* s, size_type n) { return !(N < n) ? from_c_str_impl(s, n, typename sprout::index_range<0, N>::type()) - : throw "basic_string<>: index out of range" + : throw std::out_of_range("basic_string<>: index out of range") ; } static SPROUT_CONSTEXPR basic_string from_c_str(value_type const* s) { @@ -465,7 +465,7 @@ namespace sprout { ? n == npos ? substr(pos, size() - pos) : from_c_str(c_str() + pos, n) - : throw "basic_string<>: index out of range" + : throw std::out_of_range("basic_string<>: index out of range") ; } template @@ -486,13 +486,13 @@ namespace sprout { SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string const& str, size_type pos2, size_type n2) const { return !(str.size() < pos2) ? compare(pos1, n1, str.begin() + pos2, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n2, str.size() - pos2)) - : throw "basic_string<>: index out of range" + : throw std::out_of_range("basic_string<>: index out of range") ; } SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s, size_type n2) const { return !(size() < pos1) ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, size() - pos1), s, n2) - : throw "basic_string<>: index out of range" + : throw std::out_of_range("basic_string<>: index out of range") ; } // others: @@ -560,7 +560,7 @@ namespace sprout { >::type compare(size_type pos1, size_type n1, ConstIterator s, size_type n2) const { return !(size() < pos1) ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, size() - pos1), s, n2) - : throw "basic_string<>: index out of range" + : throw std::out_of_range("basic_string<>: index out of range") ; } #endif diff --git a/sprout/uuid/name_generator.hpp b/sprout/uuid/name_generator.hpp index fbf16949..58e49695 100644 --- a/sprout/uuid/name_generator.hpp +++ b/sprout/uuid/name_generator.hpp @@ -17,7 +17,7 @@ namespace sprout { private: typedef typename result_type::value_type value_type; private: - sprout::sha1 sha_; + sprout::sha1 sha_; private: SPROUT_CONSTEXPR result_type sha_to_uuid_1(sprout::sha1::value_type const& value) const { return result_type{{ diff --git a/sprout/uuid/string_generator.hpp b/sprout/uuid/string_generator.hpp index 10c7214a..a6d7d4e3 100644 --- a/sprout/uuid/string_generator.hpp +++ b/sprout/uuid/string_generator.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,10 @@ namespace sprout { Iterator last; public: SPROUT_CONSTEXPR next_char(Iterator f, Iterator l) - : c(f != l ? *f : throw "string_generator: invalid uuid string (out of range)") + : c(f != l + ? *f + : throw std::domain_error("string_generator: invalid uuid string (out of range)") + ) , first(sprout::next(f)) , last(l) {} @@ -42,7 +46,7 @@ namespace sprout { SPROUT_CONSTEXPR std::uint8_t value_at(std::size_t i) const { return i < 22 ? sprout::uuids::detail::values::table[i] - : throw "string_generator: invalid uuid string (invalid character)" + : throw std::domain_error("string_generator: invalid uuid string (invalid character)") ; } template @@ -110,7 +114,7 @@ namespace sprout { return has_dashes ? is_dash(nc.c) ? generate_2_2(nc.next(), open_brace, has_dashes, args...) - //: throw "string_generator: invalid uuid string (dashes not found)" // ??? + //: throw std::domain_error("string_generator: invalid uuid string (dashes not found)") // ??? : generate_2_2(nc, open_brace, has_dashes, args...) : generate_2_2(nc, open_brace, has_dashes, args...) ; @@ -139,7 +143,7 @@ namespace sprout { >::type generate_2(next_char nc, Char open_brace, bool has_dashes, Args... args) const { return !open_brace || (open_brace && is_close_brace(nc.next().c, open_brace)) ? result_type{{args...}} - : throw "string_generator: invalid uuid string (brace not closed)" + : throw std::domain_error("string_generator: invalid uuid string (brace not closed)") ; } template diff --git a/sprout/uuid/uuid.hpp b/sprout/uuid/uuid.hpp index 3ce6a8c6..8b7b145e 100644 --- a/sprout/uuid/uuid.hpp +++ b/sprout/uuid/uuid.hpp @@ -29,7 +29,7 @@ namespace sprout { // class uuid { public: - typedef std::uint8_t value_type; + typedef std::uint8_t value_type; #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION typedef sprout::index_iterator iterator; typedef sprout::index_iterator const_iterator;