// Copyright 2007 Google Inc. All Rights Reserved. // Author: pmattis@google.com (Peter Mattis) // // The safe_btree_set<> is like btree_set<> except that it removes the caveat // about insertion and deletion invalidating existing iterators at a small cost // in making iterators larger and slower. #ifndef UTIL_BTREE_SAFE_BTREE_SET_H__ #define UTIL_BTREE_SAFE_BTREE_SET_H__ #include #include #include "util/btree/btree_container.h" #include "util/btree/btree_set.h" #include "util/btree/safe_btree.h" namespace util { namespace btree { // The safe_btree_set class is needed mainly for it's constructors. template , typename Alloc = std::allocator, int TargetNodeSize = 256> class safe_btree_set : public btree_unique_container< safe_btree > > { typedef safe_btree_set self_type; typedef btree_set_params params_type; typedef safe_btree btree_type; typedef btree_unique_container super_type; public: typedef typename btree_type::key_compare key_compare; typedef typename btree_type::allocator_type allocator_type; public: // Default constructor. safe_btree_set(const key_compare &comp = key_compare(), const allocator_type &alloc = allocator_type()) : super_type(comp, alloc) { } // Copy constructor. safe_btree_set(const self_type &x) : super_type(x) { } // Range constructor. template safe_btree_set(InputIterator b, InputIterator e, const key_compare &comp = key_compare(), const allocator_type &alloc = allocator_type()) : super_type(b, e, comp, alloc) { } }; template inline void swap(safe_btree_set &x, safe_btree_set &y) { x.swap(y); } } // namespace btree } // namespace util #endif // UTIL_BTREE_SAFE_BTREE_SET_H__