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/regex.tcc49
-rw-r--r--libstdc++-v3/include/bits/utility.h16
-rw-r--r--libstdc++-v3/include/bits/valarray_array.h10
-rw-r--r--libstdc++-v3/include/bits/version.def9
-rw-r--r--libstdc++-v3/include/bits/version.h10
5 files changed, 82 insertions, 12 deletions
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
index b94fe44..48917cd 100644
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -331,20 +331,53 @@ namespace __detail
&& __c == __fctyp.widen('_'));
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr
template<typename _Ch_type>
int
regex_traits<_Ch_type>::
value(_Ch_type __ch, int __radix) const
{
- std::basic_istringstream<char_type> __is(string_type(1, __ch));
- long __v;
- if (__radix == 8)
- __is >> std::oct;
- else if (__radix == 16)
- __is >> std::hex;
- __is >> __v;
- return __is.fail() ? -1 : __v;
+ if constexpr (sizeof(_Ch_type) > 1)
+ {
+ const auto& __ctyp = std::use_facet<ctype<_Ch_type>>(_M_locale);
+ const char __c = __ctyp.narrow(__ch, '\0');
+ return regex_traits<char>{}.value(__c, __radix);
+ }
+ else
+ {
+ const char __c = static_cast<char>(__ch);
+ const char __max_digit = __radix == 8 ? '7' : '9';
+ if ('0' <= __c && __c <= __max_digit)
+ return __c - '0';
+ if (__radix < 16)
+ return -1;
+ switch (__c)
+ {
+ case 'a':
+ case 'A':
+ return 10;
+ case 'b':
+ case 'B':
+ return 11;
+ case 'c':
+ case 'C':
+ return 12;
+ case 'd':
+ case 'D':
+ return 13;
+ case 'e':
+ case 'E':
+ return 14;
+ case 'f':
+ case 'F':
+ return 15;
+ default:
+ return -1;
+ }
+ }
}
+#pragma GCC diagnostic pop
template<typename _Bi_iter, typename _Alloc>
template<typename _Out_iter>
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
diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index 1bf98f7..29ecf15 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -2191,6 +2191,15 @@ ftms = {
};
};
+ftms = {
+ name = is_implicit_lifetime;
+ values = {
+ v = 202302;
+ cxxmin = 23;
+ extra_cond = "__has_builtin(__builtin_is_implicit_lifetime)";
+ };
+};
+
// Standard test specifications.
stds[97] = ">= 199711L";
stds[03] = ">= 199711L";
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index 66de8b4..5901d27 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -2455,4 +2455,14 @@
#endif /* !defined(__cpp_lib_philox_engine) */
#undef __glibcxx_want_philox_engine
+#if !defined(__cpp_lib_is_implicit_lifetime)
+# if (__cplusplus >= 202100L) && (__has_builtin(__builtin_is_implicit_lifetime))
+# define __glibcxx_is_implicit_lifetime 202302L
+# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_implicit_lifetime)
+# define __cpp_lib_is_implicit_lifetime 202302L
+# endif
+# endif
+#endif /* !defined(__cpp_lib_is_implicit_lifetime) */
+#undef __glibcxx_want_is_implicit_lifetime
+
#undef __glibcxx_want_all