auto index = table.get_index<N(exp)>();
auto upper = index.upper_bound(100);
for(auto itr = index.begin(); itr != upper; ) {
itr = index.erase(itr);
}
above is not work, who can give me an exmaple
From your code I assume you want to delete all entries on the table that have less than 100 exp.
The biggest problem I see here is not limiting how many items you delete from the table. As in this code you can possibly be telling the contract to delete 1000's of items in a single action. Which causes a "transaction took too long" error.
void eraseFromTable(int count) {
auto index = table.get_index<N(exp)>();
auto upper = index.upper_bound(100);
for(auto itr = index.begin(); count > 0 && itr != upper; count--) {
itr = index.erase(itr);
}
}