1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

support Generator Requirement: generator_iterator, random_redult

This commit is contained in:
bolero-MURAKAMI 2013-10-17 18:46:31 +09:00
parent 9f11b2481d
commit e0629a21ce
2 changed files with 15 additions and 0 deletions

View file

@ -72,6 +72,9 @@ namespace sprout {
SPROUT_CONSTEXPR generator_iterator next_generator() const {
return (*this)();
}
SPROUT_CONSTEXPR operator reference() const {
return generated_value();
}
SPROUT_CXX14_CONSTEXPR void swap(generator_iterator& other)
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(gen_, other.gen_)))
{

View file

@ -114,6 +114,12 @@ namespace sprout {
SPROUT_CONSTEXPR distribution_type const& distribution() const SPROUT_NOEXCEPT {
return distribution_;
}
SPROUT_CXX14_CONSTEXPR operator result_type&() SPROUT_NOEXCEPT {
return generated_value();
}
SPROUT_CONSTEXPR operator result_type const&() const SPROUT_NOEXCEPT {
return generated_value();
}
SPROUT_CONSTEXPR result_type min() const SPROUT_NOEXCEPT {
return distribution_.min();
}
@ -233,6 +239,12 @@ namespace sprout {
SPROUT_CONSTEXPR random_result const& next_generator() const SPROUT_NOEXCEPT {
return *this;
}
SPROUT_CXX14_CONSTEXPR operator result_type&() SPROUT_NOEXCEPT {
return generated_value();
}
SPROUT_CONSTEXPR operator result_type const&() const SPROUT_NOEXCEPT {
return generated_value();
}
SPROUT_CONSTEXPR result_type min() const SPROUT_NOEXCEPT {
return engine_.min();
}