[ox/std] Make placement new function constexpr
This commit is contained in:
parent
a5e518ec7a
commit
04c660765e
21
deps/ox/src/ox/std/new.cpp
vendored
21
deps/ox/src/ox/std/new.cpp
vendored
@ -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
|
10
deps/ox/src/ox/std/new.hpp
vendored
10
deps/ox/src/ox/std/new.hpp
vendored
@ -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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user