[ox/std] Make placement new function constexpr

This commit is contained in:
Gary Talent 2020-11-21 23:23:47 -06:00
parent a5e518ec7a
commit 04c660765e
2 changed files with 8 additions and 23 deletions

View File

@ -1,21 +0,0 @@
/*
* Copyright 2015 - 2018 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef OX_USE_STDLIB
#include "types.hpp"
void *operator new(std::size_t, void *addr) noexcept {
return addr;
}
void *operator new[](std::size_t, void *addr) noexcept {
return addr;
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 - 2018 gtalent2@gmail.com
* Copyright 2015 - 2020 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@ -25,7 +25,13 @@
#if __has_include(<new>)
#include <new>
#else
void *operator new(std::size_t, void*) noexcept;
constexpr void *operator new(std::size_t, void *addr) noexcept {
return addr;
}
constexpr void *operator new[](std::size_t, void *addr) noexcept {
return addr;
}
#endif