Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #849 Explicitly disable move operations for pools. #850

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions core/indigo-core/common/base_cpp/obj_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@
#ifndef __obj_pool_h__
#define __obj_pool_h__

#include "base_cpp/non_copyable.h"
#include "base_cpp/pool.h"

namespace indigo
{

template <typename T>
class ObjPool
class ObjPool : public NonCopyable
{
public:
ObjPool()
{
}

ObjPool(ObjPool&&) = delete; // explicitly disable move operations
ObjPool& operator=(ObjPool&&) = delete;

~ObjPool()
{
clear();
Expand Down Expand Up @@ -134,9 +138,6 @@ namespace indigo

protected:
Pool<T> _pool;

private:
ObjPool(const ObjPool<T>&); // no implicit copy
};

} // namespace indigo
Expand Down
9 changes: 5 additions & 4 deletions core/indigo-core/common/base_cpp/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@

#include "base_cpp/array.h"
#include "base_cpp/exception.h"
#include "base_cpp/non_copyable.h"

namespace indigo
{

DECL_EXCEPTION(PoolError);

template <typename T>
class Pool
class Pool : public NonCopyable
{
public:
DECL_TPL_ERROR(PoolError);
Expand All @@ -37,6 +38,9 @@ namespace indigo
{
}

Pool(Pool&&) = delete; // explicitly disable move operations
Pool& operator=(Pool&&) = delete;

int add()
{
if (_first == -1)
Expand Down Expand Up @@ -159,9 +163,6 @@ namespace indigo
int _size; // number of _array items used

int _first; // index of the first unused element (-1 if all are used)

private:
Pool(const Pool<T>&); // no implicit copy
};

} // namespace indigo
Expand Down
9 changes: 5 additions & 4 deletions core/indigo-core/common/base_cpp/ptr_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef __ptr_pool__
#define __ptr_pool__

#include "base_cpp/non_copyable.h"
#include "base_cpp/pool.h"

#ifdef _WIN32
Expand All @@ -32,13 +33,16 @@ namespace indigo
DECL_EXCEPTION(PtrPoolError);

template <typename T>
class PtrPool
class PtrPool : public NonCopyable
{
public:
explicit PtrPool()
{
}

PtrPool(PtrPool&&) = delete; // explicitly disable move operations
PtrPool& operator=(PtrPool&&) = delete;

virtual ~PtrPool()
{
clear();
Expand Down Expand Up @@ -122,9 +126,6 @@ namespace indigo

protected:
Pool<T*> _ptrpool;

private:
PtrPool(const PtrPool&); // no implicit copy
};

} // namespace indigo
Expand Down