add c++14 constexpr version: fill, fill_n

This commit is contained in:
bolero-MURAKAMI 2013-10-16 13:04:49 +09:00
parent 3f85600f53
commit 7b11799ace
11 changed files with 152 additions and 17 deletions

View file

@ -9,6 +9,22 @@
#define SPROUT_ALGORITHM_REPLACE_IF_HPP
#include <sprout/config.hpp>
namespace sprout {
//
// 25.3.5 Replace
//
template<typename ForwrdIterator, typename Predicate, typename T>
inline SPROUT_CXX14_CONSTEXPR void
replace_if(ForwrdIterator first, ForwrdIterator last, Predicate pred, T const& new_value) {
for (; first != last; ++first) {
if (pred(*first)) {
*first = new_value;
}
}
}
} // namespace sprout
#include <sprout/algorithm/fixed/replace_if.hpp>
#include <sprout/algorithm/fit/replace_if.hpp>