mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-07-02 14:04:09 +00:00
bug fix
This commit is contained in:
parent
73ead93fe5
commit
69910ca06c
6 changed files with 21 additions and 9 deletions
|
@ -11,7 +11,7 @@ namespace testspr {
|
||||||
static void algorithm_generate_test() {
|
static void algorithm_generate_test() {
|
||||||
using namespace sprout;
|
using namespace sprout;
|
||||||
{
|
{
|
||||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 10>{{0}};
|
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 10>{{}};
|
||||||
|
|
||||||
// <20>¶<EFBFBD>¬
|
// <20>¶<EFBFBD>¬
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace testspr {
|
||||||
static void algorithm_generate_n_test() {
|
static void algorithm_generate_n_test() {
|
||||||
using namespace sprout;
|
using namespace sprout;
|
||||||
{
|
{
|
||||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 10>{{0}};
|
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 10>{{}};
|
||||||
|
|
||||||
// <20>¶<EFBFBD>¬
|
// <20>¶<EFBFBD>¬
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,13 +55,13 @@ namespace sprout {
|
||||||
iterator_type last;
|
iterator_type last;
|
||||||
predicate_type pred;
|
predicate_type pred;
|
||||||
private:
|
private:
|
||||||
iterator_type satisfy_predicate() {
|
void satisfy_predicate() {
|
||||||
while (current != last && !pred(current)) {
|
while (current != last && !pred(*current)) {
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iterator_type satisfy_predicate_backward() {
|
void satisfy_predicate_backward() {
|
||||||
while (!pred(current)) {
|
while (!pred(*current)) {
|
||||||
--current;
|
--current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace sprout {
|
||||||
: old_(old_value)
|
: old_(old_value)
|
||||||
, new_(new_value)
|
, new_(new_value)
|
||||||
{}
|
{}
|
||||||
T const& operator()(T const& value) const {
|
SPROUT_CONSTEXPR T const& operator()(T const& value) const {
|
||||||
return (value == old_) ? new_ : value;
|
return (value == old_) ? new_ : value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace sprout {
|
||||||
: pred_(pred)
|
: pred_(pred)
|
||||||
, new_(new_value)
|
, new_(new_value)
|
||||||
{}
|
{}
|
||||||
T const& operator()(T const& value) const {
|
SPROUT_CONSTEXPR T const& operator()(T const& value) const {
|
||||||
return pred(value) ? new_ : value;
|
return pred_(value) ? new_ : value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
|
@ -67,6 +67,18 @@ namespace testspr {
|
||||||
public:
|
public:
|
||||||
SPROUT_CONSTEXPR bool operator()(T const& t) const { return t % 2 != 0; }
|
SPROUT_CONSTEXPR bool operator()(T const& t) const { return t % 2 != 0; }
|
||||||
};
|
};
|
||||||
|
//
|
||||||
|
// is_multiple_of
|
||||||
|
//
|
||||||
|
template<typename T, typename U = T>
|
||||||
|
struct is_multiple_of {
|
||||||
|
public:
|
||||||
|
typedef T first_argument_type;
|
||||||
|
typedef U second_argument_type;
|
||||||
|
typedef bool result_type;
|
||||||
|
public:
|
||||||
|
SPROUT_CONSTEXPR bool operator()(T const& t, U const& u) const { return t % u == 0; }
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// less
|
// less
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue