AK
foo(вариант
hello
, is_cruel()
? cruel_world
: not_cruel_world
)
foo(выглядит как-то чище
hello,
is_cruel()
? cruel_world
: not_cruel_world
)
Size: a a a
AK
foo(вариант
hello
, is_cruel()
? cruel_world
: not_cruel_world
)
foo(выглядит как-то чище
hello,
is_cruel()
? cruel_world
: not_cruel_world
)
PZ
bool is_special = special(
a, b,
we_are_descending_to_hell(
a, b
)
);
bool a_plus_b_evaluated_to_special_value =
std::set{0, 1, 2}.contains(a + b);
if (a_plus_b_evaluated_to_special_value || is_special)
{ /* ... */ }
CD
CD
bool is_special = special(
a, b,
we_are_descending_to_hell(
a, b
)
);
bool a_plus_b_evaluated_to_special_value =
std::set{0, 1, 2}.contains(a + b);
if (a_plus_b_evaluated_to_special_value || is_special)
{ /* ... */ }
if (std::move(a_plus_b_evaluated_to_special_value) || std::move(is_special))а потом кто-нибудь всё-таки use after move
{ /* ... */ }
O
if (a_plus_b_evaluated_to_special_value(a, b) || is_special(a, b)) {}но разбираться, какое же смысловое значения в итоге собирается из сложного булевого выражения среднестатистическому программисту сложно
O
if (std::move(a_plus_b_evaluated_to_special_value) || std::move(is_special))а потом кто-нибудь всё-таки use after move
{ /* ... */ }
bool
жеDV
CD
if (
[] (auto&& x) {
return x == 0 || x == 1 || x == 2;
} (a + b)
|| //...
)
D
D
if (
[] (auto&& x) {
return x == 0 || x == 1 || x == 2;
} (a + b)
|| //...
)
BU
if (
[] (auto&& x) {
return x == 0 || x == 1 || x == 2;
} (a + b)
|| //...
)
PZ
bool is_special = special(
a, b,
we_are_descending_to_hell(
a, b
)
);
bool a_plus_b_evaluated_to_special_value =
std::set{0, 1, 2}.contains(a + b);
if (a_plus_b_evaluated_to_special_value || is_special)
{ /* ... */ }
auto is_special =
[]
(auto a, auto b) -> bool
{
return special(
a,
b,
we_are_descending_to_hell(
a,
b
)
);
};
bool one_of =
[]
(auto v, auto s) -> bool
{
return s.contains(v);
}
if (one_of(a + b, std::set{0, 1, 2}) || is_special(a, b))
{
/* ... */
}
PZ
CD
bool
жеCD
auto is_special =
[]
(auto a, auto b) -> bool
{
return special(
a,
b,
we_are_descending_to_hell(
a,
b
)
);
};
bool one_of =
[]
(auto v, auto s) -> bool
{
return s.contains(v);
}
if (one_of(a + b, std::set{0, 1, 2}) || is_special(a, b))
{
/* ... */
}
PZ
PZ
BU
CD
auto is_special = [] (auto a, auto b) {
return special(
a,
b,
we_are_descending_to_hell(
a,
b
)
);
};
PZ