mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Update code to avoid multiple bind1st objects in loop
This commit is contained in:
parent
c944a978e0
commit
c46680ed81
@ -1894,11 +1894,12 @@ namespace etl
|
||||
|
||||
for (TIterator1 i = begin1; i != end1; ++i)
|
||||
{
|
||||
if (i == etl::find_if(begin1, i, etl::bind1st(predicate, *i)))
|
||||
const typename etl::binder1st<TBinaryPredicate> predicate_is_i = etl::bind1st(predicate, *i);
|
||||
if (i == etl::find_if(begin1, i, predicate_is_i))
|
||||
{
|
||||
size_t n = etl::count_if(begin2, end2, etl::bind1st(predicate, *i));
|
||||
size_t n = etl::count_if(begin2, end2, predicate_is_i);
|
||||
|
||||
if (n == 0 || size_t(etl::count_if(i, end1, etl::bind1st(predicate, *i))) != n)
|
||||
if (n == 0 || size_t(etl::count_if(i, end1, predicate_is_i)) != n)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1968,11 +1969,12 @@ namespace etl
|
||||
{
|
||||
for (TIterator1 i = begin1; i != end1; ++i)
|
||||
{
|
||||
if (i == etl::find_if(begin1, i, etl::bind1st(predicate, *i)))
|
||||
const typename etl::binder1st<TBinaryPredicate> predicate_is_i = etl::bind1st(predicate, *i);
|
||||
if (i == etl::find_if(begin1, i, predicate_is_i))
|
||||
{
|
||||
size_t n = etl::count_if(begin2, end2, etl::bind1st(predicate, *i));
|
||||
size_t n = etl::count_if(begin2, end2, predicate_is_i);
|
||||
|
||||
if (n == 0 || size_t(etl::count_if(i, end1, etl::bind1st(predicate, *i))) != n)
|
||||
if (n == 0 || size_t(etl::count_if(i, end1, predicate_is_i)) != n)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user