+template <typename T> void Keyval::cleanup_attr(){
+ if (not attributes()->empty()) {
+ int flag=0;
+ for(auto it : attributes_){
+ try{
+ smpi_key_elem elem = T::keyvals_.at(it.first);
+ if(elem != nullptr){
+ call_deleter<T>((T*)this, elem, it.first,it.second,&flag);
+ }
+ }catch(const std::out_of_range& oor) {
+ //already deleted, not a problem;
+ flag=0;
+ }
+ }
+ }
+}
+