/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#pragma once
#include
#include
namespace ams::sf {
template class StdAllocator>
class StdAllocationPolicy {
public:
static constexpr bool HasStatefulAllocator = false;
using Allocator = impl::StatelessDummyAllocator;
template
struct StatelessAllocator {
static void *Allocate(size_t size) {
return StdAllocator().allocate(size / sizeof(T));
}
static void Deallocate(void *ptr, size_t size) {
StdAllocator().deallocate(static_cast(ptr), size / sizeof(T));
}
};
template
static void *AllocateAligned(size_t size, size_t align) {
return StdAllocator().allocate(size / sizeof(T));
}
template
static void DeallocateAligned(void *ptr, size_t size, size_t align) {
StdAllocator().deallocate(static_cast(ptr), size / sizeof(T));
}
};
}