public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Simplify std::allocator_traits<allocator<void>>::construct
@ 2022-01-05 13:48 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-01-05 13:48 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested powerpc64le-linux, pushed to trunk.


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.
---
 libstdc++-v3/include/bits/alloc_traits.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h
index f51049f4a51..fa93feb7198 100644
--- a/libstdc++-v3/include/bits/alloc_traits.h
+++ b/libstdc++-v3/include/bits/alloc_traits.h
@@ -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`
-- 
2.31.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-05 13:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 13:48 [committed] libstdc++: Simplify std::allocator_traits<allocator<void>>::construct Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).