aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/utility.h16
-rw-r--r--libstdc++-v3/include/bits/valarray_array.h10
2 files changed, 22 insertions, 4 deletions
diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h
index 4e57465..96ac698 100644
--- a/libstdc++-v3/include/bits/utility.h
+++ b/libstdc++-v3/include/bits/utility.h
@@ -172,6 +172,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using index_sequence_for = make_index_sequence<sizeof...(_Types)>;
#endif // __glibcxx_integer_sequence
+#if __cpp_structured_bindings >= 202411L
+#if __has_builtin(__integer_pack)
+ template <auto _Num, typename _Tp = decltype(_Num)>
+ inline constexpr _Tp
+ _IotaArray[_Num] = {__integer_pack(_Tp(_Num))...};
+#elif defined __glibcxx_integer_sequence
+ template <auto _Num, typename _Tp = decltype(_Num), typename = make_integer_sequence<_Tp, _Num>>
+ inline constexpr _Tp
+ _IotaArray[_Num];
+
+ template <auto _Num, typename _Tp, _Tp... _Is>
+ inline constexpr _Tp
+ _IotaArray<_Num, _Tp, integer_sequence<_Tp, _Is...>>[_Num] = {_Is...};
+#endif // __integer_pack
+#endif // __cpp_structured_bindings >= 202411L
+
#if __cplusplus >= 201703L
struct in_place_t {
diff --git a/libstdc++-v3/include/bits/valarray_array.h b/libstdc++-v3/include/bits/valarray_array.h
index b5c02b7..d1b712c 100644
--- a/libstdc++-v3/include/bits/valarray_array.h
+++ b/libstdc++-v3/include/bits/valarray_array.h
@@ -38,6 +38,7 @@
#include <bits/c++config.h>
#include <bits/cpp_type_traits.h>
+#include <bits/new_allocator.h>
#include <cstdlib>
#include <new>
@@ -57,12 +58,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
inline _Tp*
__valarray_get_storage(size_t __n)
- { return static_cast<_Tp*>(operator new(__n * sizeof(_Tp))); }
+ { return std::__new_allocator<_Tp>().allocate(__n); }
// Return memory to the system
- inline void
- __valarray_release_memory(void* __p)
- { operator delete(__p); }
+ template<typename _Tp>
+ inline void
+ __valarray_release_memory(_Tp* __p, size_t __n)
+ { std::__new_allocator<_Tp>().deallocate(__p, __n); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr