2015-12-07 23:27:53 +03:00
|
|
|
/*
|
|
|
|
* Vector.h
|
|
|
|
*
|
|
|
|
* Created on: 7 Dec 2015
|
|
|
|
* Author: hieu
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2015-12-10 08:49:51 +03:00
|
|
|
#include <cassert>
|
2015-12-07 23:27:53 +03:00
|
|
|
#include "MemPool.h"
|
|
|
|
|
2015-12-10 23:49:30 +03:00
|
|
|
namespace Moses2
|
|
|
|
{
|
|
|
|
|
2016-03-31 23:00:16 +03:00
|
|
|
template<typename T>
|
|
|
|
class Vector: public std::vector<T, MemPoolAllocator<T> >
|
2016-01-12 15:10:56 +03:00
|
|
|
{
|
2016-03-30 14:20:20 +03:00
|
|
|
typedef std::vector<T, MemPoolAllocator<T> > Parent;
|
2015-12-10 08:49:51 +03:00
|
|
|
|
2016-01-12 15:10:56 +03:00
|
|
|
public:
|
2016-03-31 23:00:16 +03:00
|
|
|
Vector(MemPool &pool, size_t size = 0, const T &val = T()) :
|
|
|
|
Parent(size, val, MemPoolAllocator<T>(pool))
|
2015-12-11 00:21:52 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-26 14:21:37 +03:00
|
|
|
Vector(const Vector ©) :
|
|
|
|
Parent(copy)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-12-07 23:27:53 +03:00
|
|
|
protected:
|
|
|
|
};
|
|
|
|
|
2016-02-25 16:26:31 +03:00
|
|
|
|
2015-12-10 23:49:30 +03:00
|
|
|
}
|
|
|
|
|