This repository has been archived on 2024-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
2022-12-18 22:44:34 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
|
|
|
|
template <class T>
|
2023-01-29 20:54:13 +00:00
|
|
|
requires(!std::is_array_v<T>)
|
|
|
|
std::unique_ptr<T> make_unique_for_overwrite() {
|
2022-12-18 22:44:34 +00:00
|
|
|
return std::unique_ptr<T>(new T);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
2023-01-29 20:54:13 +00:00
|
|
|
requires std::is_unbounded_array_v<T>
|
|
|
|
std::unique_ptr<T> make_unique_for_overwrite(std::size_t n) {
|
2022-12-18 22:44:34 +00:00
|
|
|
return std::unique_ptr<T>(new std::remove_extent_t<T>[n]);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T, class... Args>
|
2023-01-29 20:54:13 +00:00
|
|
|
requires std::is_bounded_array_v<T>
|
2022-12-18 22:44:34 +00:00
|
|
|
void make_unique_for_overwrite(Args&&...) = delete;
|
|
|
|
|
|
|
|
} // namespace Common
|