update boost on linux
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// detail/object_pool.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -35,6 +35,12 @@ public:
|
||||
return new Object;
|
||||
}
|
||||
|
||||
template <typename Object, typename Arg>
|
||||
static Object* create(Arg arg)
|
||||
{
|
||||
return new Object(arg);
|
||||
}
|
||||
|
||||
template <typename Object>
|
||||
static void destroy(Object* o)
|
||||
{
|
||||
@@ -97,6 +103,25 @@ public:
|
||||
return o;
|
||||
}
|
||||
|
||||
// Allocate a new object with an argument.
|
||||
template <typename Arg>
|
||||
Object* alloc(Arg arg)
|
||||
{
|
||||
Object* o = free_list_;
|
||||
if (o)
|
||||
free_list_ = object_pool_access::next(free_list_);
|
||||
else
|
||||
o = object_pool_access::create<Object>(arg);
|
||||
|
||||
object_pool_access::next(o) = live_list_;
|
||||
object_pool_access::prev(o) = 0;
|
||||
if (live_list_)
|
||||
object_pool_access::prev(live_list_) = o;
|
||||
live_list_ = o;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
// Free an object. Moves it to the free list. No destructors are run.
|
||||
void free(Object* o)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user