本文整理汇总了C++中params_t::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ params_t::erase方法的具体用法?C++ params_t::erase怎么用?C++ params_t::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类params_t
的用法示例。
在下文中一共展示了params_t::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_openid_vars
void remove_openid_vars(params_t& params) {
map<string,string>::iterator iter, iter_next;
for(iter = params.begin(); iter != params.end(); ) {
iter_next = iter;
++iter_next;
string param_key(iter->first);
// if starts with openid. or modauthopenid. (for the nonce) or openid_identifier (the login) remove it
if((param_key.substr(0, 7) == "openid." || param_key.substr(0, 14) == "modauthopenid." || param_key == "openid_identifier")) {
params.erase(iter); // invalidates iter, but its successor iter_next is still valid
}
iter = iter_next;
}
};
示例2: remove_openid_vars
void remove_openid_vars(params_t& params) {
map<string,string>::iterator iter;
for(iter = params.begin(); iter != params.end(); iter++) {
string param_key(iter->first);
// if starts with openid. or modauthopenid. (for the nonce) or openid_identifier (the login) remove it
if((param_key.substr(0, 7) == "openid." || param_key.substr(0, 14) == "modauthopenid." || param_key == "openid_identifier")) {
params.erase(param_key);
// stupid map iterator screws up if we just continue the iteration...
// so recursion to the rescue - we'll delete them one at a time
remove_openid_vars(params);
return;
}
}
};