add compost utility

This commit is contained in:
bolero-MURAKAMI 2012-12-07 02:31:16 +09:00
parent 24d2a229f3
commit b44f7c8f2a
14 changed files with 670 additions and 29 deletions

View file

@ -96,7 +96,9 @@ namespace sprout {
}
SPROUT_CONSTEXPR reference operator*() const {
using sprout::sin;
return amplitude_ * sin(d_ * value_type(index_) + phase_);
return amplitude_ == 0 ? 0
: amplitude_ * sin(d_ * value_type(index_) + phase_)
;
}
SPROUT_CONSTEXPR pointer operator->() const {
return &operator*()();
@ -137,7 +139,9 @@ namespace sprout {
}
SPROUT_CONSTEXPR reference operator[](difference_type n) const {
using sprout::sin;
return amplitude_ * sin(d_ * value_type(index_ + n) + phase_);
return amplitude_ == 0 ? 0
: amplitude_ * sin(d_ * value_type(index_ + n) + phase_)
;
}
SPROUT_CONSTEXPR sinusoid_iterator next() const {
return sinusoid_iterator(*this, index_ + 1);