0
点赞
收藏
分享

微信扫一扫

EOS template function for easily clearing multi_index table

架构大数据双料架构师 2022-02-09 阅读 40
p2plinqgnu

You can use the following implementation:

template<uint64_t A, typename B, typename... C> void clear_table(multi_index<A, B, C...>* table) {
    auto it = table->begin();
    while (it != table->end()) {
        it = table->erase(it);
    }
}
  • A,B,C are template parameters of multi_index, you can look them up in multi_index.hpp. A - is a table name, B - is a struct, stored in table, C - is indices list. You don't need to pass them, you just pass a table and params will be deducted 
     
举报

相关推荐

0 条评论