gpt4 book ai didi

c++ - 如何确保我已经对 std::set 中的每一对元素进行了插入循环操作?

转载 作者:行者123 更新时间:2023-11-28 02:35:31 24 4
gpt4 key购买 nike

std::set<BooleanFunction>::iterator  it;
for(it=closure.begin (); it!=closure.end (); ++it)
{

std::set<BooleanFunction>::iterator jit;
for(jit=closure.begin (); jit!=closure.end (); ++jit)
{

for(uint i=0U; i<it->Arity (); ++i)
{ BooleanFunction f = it->Superposition (*jit, i);

if( f.Arity () <= test.Arity () )
closure.insert (f);
}
}
}

如何确保每两个元素彼此叠加?

编辑:自叠加也是可能的:f(f(x)), f(f(f(x))), ... - 没问题。

最佳答案

我认为您可以像下面这样使用 2 组。

std::set<BooleanFunction> builder
std::set<BooleanFunction>::iterator it;
for(it=closure.begin (); it!=closure.end (); ++it)
{
bulider.insert(*it);
for(uint i=0U; i<it->Arity (); ++i)
{
BooleanFunction f = it->Superposition (*it, i);
if( f.Arity () <= test.Arity () )
builder.insert (f);
}
}

关于c++ - 如何确保我已经对 std::set 中的每一对元素进行了插入循环操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27605851/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com