#include "discard.hpp"
#include "declval.hpp"
#include "forward.hpp"
Go to the source code of this file.
|
constexpr void * | operator new (bsl::uintmax count, void *ptr) noexcept |
| This function implements the placement new operator. Note that this function is passed a count and pointer, both of which are ignored. More...
|
|
template<typename T , typename... ARGS> |
constexpr void | std::construct_at_impl (void *const ptr, ARGS &&... args) noexcept(noexcept(new(ptr) T{bsl::declval< ARGS >()...})) |
| Implements a constexpr version of placement new. that can be used by BSL's APIs to support constexpr based APIs. More...
|
|
template<typename T , typename... ARGS> |
constexpr void | bsl::construct_at (void *const ptr, ARGS &&... args) noexcept(noexcept(std::construct_at_impl< T, ARGS... >(ptr, bsl::declval< ARGS >()...))) |
| Implements a constexpr version of placement new. that can be used by BSL's APIs to support constexpr based APIs. More...
|
|
- Copyright
- Copyright (C) 2020 Assured Information Security, Inc.
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
◆ operator new()
constexpr void* operator new |
( |
bsl::uintmax |
count, |
|
|
void * |
ptr |
|
) |
| |
|
noexcept |
This function implements the placement new operator. Note that this function is passed a count and pointer, both of which are ignored.
- Parameters
-
count | ignored |
ptr | the ptr to return |
- Returns
- returns ptr
◆ construct_at_impl()
template<typename T , typename... ARGS>
constexpr void std::construct_at_impl |
( |
void *const |
ptr, |
|
|
ARGS &&... |
args |
|
) |
| |
|
noexcept |
Implements a constexpr version of placement new. that can be used by BSL's APIs to support constexpr based APIs.
- Note
- C++20 right now only allows for constexpr placement new to occur from the standard library (a practice I hope changes in the next release as that is horrible). For this reason, we implement the placement new from the std namespace (uhg) and then call this from our BSL function. This rule is so easy to bypass, I am at a loss as to why they did this, but at least this approach works so that third party libraries can still take advantage of this C++20 feature.
- Template Parameters
-
T | the type of object to initialize |
ARGS | the types of args to initialize T with |
- Parameters
-
ptr | a pointer to the object to initialize |
args | the args to initialize T with |
- Exceptions
-
throws | if T throws during construction |
◆ construct_at()
template<typename T , typename... ARGS>
constexpr void bsl::construct_at |
( |
void *const |
ptr, |
|
|
ARGS &&... |
args |
|
) |
| |
|
noexcept |
Implements a constexpr version of placement new. that can be used by BSL's APIs to support constexpr based APIs.
- Template Parameters
-
T | the type of object to initialize |
ARGS | the types of args to initialize T with |
- Parameters
-
ptr | a pointer to the object to initialize |
args | the args to initialize T with |
- Exceptions
-
throws | if T throws during construction |