forked from boostorg/unordered
Simplify the hash table implementation somewhat and avoid an unnecessary copy
for maps. [SVN r3339]
This commit is contained in:
1 parent
5c32477723
commit
905a2dd28a
2 files changed
+207
-259
No files matched your search
@@ -115,6 +115,7 @@ namespace boost {
|
||||
template <class Allocator>
|
||||
struct allocator_constructor
|
||||
{
|
||||
typedef typename Allocator::value_type value_type;
|
||||
typedef typename allocator_pointer<Allocator>::type pointer;
|
||||
|
||||
Allocator& alloc_;
|
||||
@@ -138,12 +139,24 @@ namespace boost {
|
||||
|
||||
template <class V>
|
||||
void construct(V const& v) {
|
||||
BOOST_ASSERT(!ptr_ && !constructed_);
|
||||
ptr_ = alloc_.allocate(1);
|
||||
alloc_.construct(ptr_, value_type(v));
|
||||
constructed_ = true;
|
||||
}
|
||||
|
||||
void construct(value_type const& v) {
|
||||
BOOST_ASSERT(!ptr_ && !constructed_);
|
||||
ptr_ = alloc_.allocate(1);
|
||||
alloc_.construct(ptr_, v);
|
||||
constructed_ = true;
|
||||
}
|
||||
|
||||
pointer get() const
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
// no throw
|
||||
pointer release()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user