]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Simplify std::allocator_traits<allocator<void>>::construct
authorJonathan Wakely <jwakely@redhat.com>
Tue, 4 Jan 2022 16:39:01 +0000 (16:39 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 4 Apr 2022 11:45:30 +0000 (12:45 +0100)
We don't need a preprocessor condition to decide whether to use
placement new or std::construct_at, because std::_Construct already does
that.

libstdc++-v3/ChangeLog:

* include/bits/alloc_traits.h (allocator_traits<allocator<void>>):
Use std::_Construct for construct.

(cherry picked from commit 917c7b136e8b556b0027223058006a6caeb56871)

libstdc++-v3/include/bits/alloc_traits.h

index 602a90d4d8a63a19e89820fda7fc0acd4039064e..5e19ffece50409c8ef9d72312765a8bdd3808db4 100644 (file)
@@ -632,13 +632,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        static _GLIBCXX20_CONSTEXPR void
        construct(allocator_type&, _Up* __p, _Args&&... __args)
        noexcept(std::is_nothrow_constructible<_Up, _Args...>::value)
-       {
-#if __cplusplus <= 201703L
-         ::new((void *)__p) _Up(std::forward<_Args>(__args)...);
-#else
-         std::construct_at(__p, std::forward<_Args>(__args)...);
-#endif
-       }
+       { std::_Construct(__p, std::forward<_Args>(__args)...); }
 
       /**
        *  @brief  Destroy an object of type `_Up`