我是新的提升。我有一个在lambda函数中使用dynamic_bitset
的程序。在我尝试运行该程序后,我收到了此消息。即使没有初始化bitset
及其处理函数的函数,也会显示此消息。dynamic_bitset,崩溃我的程序
有人知道这个信息的含义是什么,可能是什么问题?
消息:
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp:616:
boost::dynamic_bitset<Block, Allocator>::~dynamic_bitset() [with Block = long unsigned int, Allocator = std::allocator<long unsigned int>]
:断言'm_check_invariants()'
失败。 中止
良好的代码是一样的东西给这个函数这个
主要电话:
int Molecule::initSimilarity(int depth){
cout << "_size is: " << _size << "\t depth is: " << depth << endl; //TODO delete
AtomSet viewing(_size);
int m = 0;
{
// break into initial groups by symbol and valancy
for(int i=0 ; i<_size ; i++)
{
if(viewing[i]) continue;
AtomSet mask = getSetMask(//AtomSet is typedef for dynamic_bitset
[&](const Atom& b)->bool
{
return (!viewing[b._index] && b._valence == _atoms[i]->_valence && strcmp(b._symbol, _atoms[i]->_symbol) == 0);
},
[&](Atom &b)
{
b._class = m; //set the equivalence class of atom 'b' to 'm'
}
);
m++;
viewing |= mask; //viewing now contains a set of atoms and for each atom it's equivalence class
}
cout << "number of equivalence class: " << m << endl; //TODO DELETE!
}
for (int j = 0; j < depth ; j++){
AtomSet viewed(_size);
int before = m;
// iteratively refine the breakdown into groups
for (int i = 0 ; i < _size ; i++) //for any atom A
{
if (viewed[i]) continue;
viewed.flip(i);
AtomSet mask = getSetMask(//put all atoms which are equivalnt but not similar to A in
//their own equivalence class
[&](const Atom& b)->bool
{
if (viewed[b._index])
return false; //if b is in viewed return false;
if (_atoms[i]->_class == b._class) //if in the same class add b to viewed
{
viewed.flip(b._index);
bool similar = !isSimilar(*_atoms[i],b);
return similar;
}
return false;
},
[&m](Atom& b)
{
b._class = m;
}
);
if (!mask.none()) m++;
}
if (before == m){
std::cout << "Finished early after just " << j << " iterations" << std::endl;
return m;
}
}
return m;
}
getSetMask的签名是: AtomSet getSetMask(STD ::功能特性,标准::功能行动);
,而最古怪的事情,即使我删除该功能的所有内容仍然给我的错误信息
如果您希望人们发现错误,您应该发布产生错误的代码。 – sth
如果在没有该功能的情况下错误仍然存在,那么问题的根源可能不在该功能中。此外,代码没有提及任何'dynamic_bitset'。另外:getSetMask()用这些lambda函数做什么?它是否存储在某个地方? – sth
对不起,你是对的。 AtomSet是dynamic_bitset的typedef。我会eddit –