// See the C++ documentation for documentation.
-// Placement new and delete (taken from glibcxx, should be fine copyright-wise):
+// Implementation for placement new and delete taken from glibcxx.
[[nodiscard]] inline void* operator new(unsigned long, void* p) noexcept {
return p;
}
namespace amy {
-// "Launder" taken from glibcxx, should be fine copyright-wise:
+// Implementation for launder taken from glibcxx.
template <typename T>
[[nodiscard]] constexpr T* launder(T* p) noexcept {
return __builtin_launder(p);
template <typename T> constexpr size byte_align() {
return alignof(T);
}
+// Implementation based on https://en.cppreference.com/w/cpp/utility/declval
+template <typename T> constexpr T&& declval() noexcept {
+ static_assert(false, "amy::declval cannot be used in an evaluated context.");
+}
} // namespace amy