本文整理汇总了C++中Allocator::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Allocator::GetSize方法的具体用法?C++ Allocator::GetSize怎么用?C++ Allocator::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Allocator
的用法示例。
在下文中一共展示了Allocator::GetSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memmove
Allocator::Allocator(const Allocator &other)
:m_chunk({0,nullptr})
,m_size(0)
,m_mem(nullptr)
{
this->Alloc(other.GetSize());
memmove(this->GetPtr(), other.GetPtr(), other.GetSize());
}
示例2: alloc
#define CATCH_CONFIG_MAIN
#include <iostream>
#include "catch.hpp"
#include "allocator.h"
TEST_CASE("MemoryAllocator")
{
SECTION("Ctor")
{
SECTION("Default")
{
Allocator alloc;
CHECK(alloc.GetSize() == DEFAULT_MAX_CAPACITY);
CHECK(alloc.GetMinChunkSize() == DEFAULT_MIN_CHUNK_SIZE);
}
SECTION("pow of 2 vals")
{
Allocator alloc(1024, 16);
CHECK(alloc.GetSize() == 1024);
CHECK(alloc.GetMinChunkSize() == 16);
}
SECTION("wrong vals")
{
Allocator alloc(2048, 3);
CHECK(alloc.GetSize() == 2048);
CHECK(alloc.GetMinChunkSize() == 16);
}
示例3: Allocator
ProxyAllocator::ProxyAllocator(Allocator &allocator)
: Allocator(allocator.GetSize(), allocator.GetStart()), allocator(allocator)
{
}