diff --git a/include/boost/unordered/detail/foa.hpp b/include/boost/unordered/detail/foa.hpp index 684aefdd..b7c7d8b3 100644 --- a/include/boost/unordered/detail/foa.hpp +++ b/include/boost/unordered/detail/foa.hpp @@ -1137,17 +1137,6 @@ union uninitialized_storage ~uninitialized_storage(){} }; -template -struct drop_guard -{ - using type_policy=TypePolicy; - - A& a; - T* p; - ~drop_guard(){type_policy::destroy(a,p);}; -}; - - /* foa::table interface departs in a number of ways from that of C++ unordered * associative containers because it's not for end-user consumption * (boost::unordered_[flat|node]_[map|set]) wrappers complete it as @@ -1454,7 +1443,7 @@ public: type_policy::construct(al(),p,std::forward(args)...); - drop_guard guard{al(),p}; + destroy_on_exit guard{al(),p}; return emplace_impl(type_policy::move(*p)); } @@ -1658,6 +1647,16 @@ private: bool rollback_=false; }; + template + struct destroy_on_exit + { + using type_policy=TypePolicy; + + Allocator &a; + T *p; + ~destroy_on_exit(){type_policy::destroy(a,p);}; + }; + Hash& h(){return hash_base::get();} const Hash& h()const{return hash_base::get();} Pred& pred(){return pred_base::get();}