1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix iterator distance implementation and adapt-interface

This commit is contained in:
bolero-MURAKAMI 2012-09-26 18:42:43 +09:00
parent a4c7df65e0
commit aec15c55a8
15 changed files with 194 additions and 154 deletions

View file

@ -187,12 +187,24 @@ namespace sprout {
SPROUT_CONSTEXPR result_type const& result() const {
return result_;
}
result_type& generated_value() {
return result_;
}
SPROUT_CONSTEXPR result_type const& generated_value() const {
return result_;
}
engine_type& engine() {
return engine_;
}
SPROUT_CONSTEXPR engine_type const& engine() const {
return engine_;
}
engine_type& next_generator() {
return engine_;
}
SPROUT_CONSTEXPR engine_type const& next_generator() const {
return engine_;
}
SPROUT_CONSTEXPR result_type min() const {
return engine_.min();
}
@ -244,15 +256,41 @@ namespace sprout {
}
//
// next
// iterator_next
//
template<typename Engine, typename Distribution>
SPROUT_CONSTEXPR sprout::random::random_result<Engine, Distribution> next(
sprout::random::random_result<Engine, Distribution> const& it
)
{
SPROUT_CONSTEXPR sprout::random::random_result<Engine, Distribution>
iterator_next(sprout::random::random_result<Engine, Distribution> const& it) {
return it();
}
//
// generated_value
//
template<typename Engine, typename Distribution>
inline SPROUT_CONSTEXPR typename sprout::random::random_result<Engine, Distribution>::result_type const&
generated_value(sprout::random::random_result<Engine, Distribution> const& t) {
return t.generated_value();
}
template<typename Engine, typename Distribution>
inline typename sprout::random::random_result<Engine, Distribution>::result_type&
generated_value(sprout::random::random_result<Engine, Distribution>& t) {
return t.generated_value();
}
//
// next_generator
//
template<typename Engine, typename Distribution>
inline SPROUT_CONSTEXPR typename sprout::random::random_result<Engine, Distribution>::engine_type const&
next_generator(sprout::random::random_result<Engine, Distribution> const& t) {
return t.next_generator();
}
template<typename Engine, typename Distribution>
inline typename sprout::random::random_result<Engine, Distribution>::engine_type&
next_generator(sprout::random::random_result<Engine, Distribution>& t) {
return t.next_generator();
}
} // namespace random
using sprout::random::random_result;