我有一个类事务的向量,并尝试使用以下代码删除一定范围的元素。编译时我得到错误:
"错误:使用已删除的函数'std :: atomic_bool& std :: atomic_bool :: operator =(const std :: atomic_bool&)"
删除具有原子布尔成员的类的正确方法是什么?
void Transactions::forget(size_t up_to)
{
size_t deletion_limit = up_to - forgotten_;
transactions_.erase(transactions_.begin(),transactions_.begin()+deletion_limit)
forgotten_ += up_to;
}
其中,transaction是我的类Transaction
的向量class Transaction {
public:
Transaction(std::vector<Insert> &&insert_ops, std::vector<Remove> &&remove_ops);
void process_inserts();
void process_removes(Database &database);
bool inserts_processed();
bool removes_processed();
Affected get_affected_inserts(Relation relation);
Affected get_affected_deletes(Relation relation);
private:
// Clear after being processed
std::vector<Insert> *insert_ops_;
std::vector<Remove> *remove_ops_;
std::atomic_bool inserts_done_, removes_done_;
std::map<Relation, Affected> inserted_tuples_, removed_tuples_;
};