aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Khalyavin <halyavin@gmail.com>2022-05-26 20:37:34 +0300
committerAndrey Khalyavin <halyavin@gmail.com>2022-05-26 20:37:34 +0300
commita983ee268a191f2757454e98e94d36615ee1339b (patch)
tree055e74fe7ae499ccc794ebd2b7bdef9004414850
parenta5bc0482bae2efd3f9a770e96967a317b5c26632 (diff)
downloadydb-a983ee268a191f2757454e98e94d36615ee1339b.tar.gz
Update libc++ to revision ab0554b2 (31 Jan 2022).
Notable changes: * allow using thread safety annotation in MinGW mode * implement compare_{strong,weak,partial}_fallback * omit atomic_{,un}signed_lock_free on platforms that doesn't support lock free atomics * set enable_borrowed_range template variable for ref_view and empty_view * fix bug in reverse_iterator::operator= * move some function from directory_iterator.cpp to a header so that they can be reused * fix bug in ranges::advance when try to advance by 0 * fix missing constraint which affects common_iterator for output iterators * correctly handle move-only iterators in move_iterator * make base() method in counted_iterator and transform_view::iterator noexcept * remove C++03 workarounds in reference_wrapper, since clang supports necessary features in C++03 mode * simplify convertible_to concept implementation * fix issue with __convertible_to_non_slicing rejecting correct case * remove excessive wrapping in std::ref and std::cref * fix std::seed_seq constructors * remove std::basic_string base class when using ABI v2 * std::basic_string::reserve now never shrinks in all C++ modes ref:b62ec6bac0283b075dd2348bad7e8a271155b378
-rw-r--r--build/ymake.core.conf2
-rwxr-xr-xcontrib/libs/cxxsupp/libcxx/import2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__compare/compare_partial_order_fallback.h73
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__compare/compare_strong_order_fallback.h70
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__compare/compare_weak_order_fallback.h70
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h5
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h15
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__config7
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h19
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h13
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h14
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/iter_move.h15
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/iter_swap.h5
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h5
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h31
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/empty_view.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h10
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/atomic3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/compare14
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/module.modulemap23
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/string96
-rw-r--r--contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp89
-rw-r--r--contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h82
-rw-r--r--contrib/libs/cxxsupp/libcxx/src/string.cpp2
29 files changed, 457 insertions, 227 deletions
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index 90023a8169..705574e299 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -9,7 +9,7 @@
FAKEID=3141592653
SANDBOX_FAKEID=${FAKEID}.7600000
-CPP_FAKEID=9403851
+CPP_FAKEID=9488872
GO_FAKEID=9478151
ANDROID_FAKEID=8821472
CLANG_TIDY_FAKEID=8625699
diff --git a/contrib/libs/cxxsupp/libcxx/import b/contrib/libs/cxxsupp/libcxx/import
index 73bee19dbe..59ee62b154 100755
--- a/contrib/libs/cxxsupp/libcxx/import
+++ b/contrib/libs/cxxsupp/libcxx/import
@@ -1,6 +1,6 @@
#!/bin/sh -e
-rev=4684857a
+rev=ab0554b2
output_dir="libcxx-r$rev"
if [ -z $1 ] ; then
git clone https://github.com/llvm/llvm-project.git --no-checkout "$output_dir/tmp"
diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/compare_partial_order_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__compare/compare_partial_order_fallback.h
new file mode 100644
index 0000000000..895523b38f
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__compare/compare_partial_order_fallback.h
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK
+#define _LIBCPP___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK
+
+#include <__compare/ordering.h>
+#include <__compare/partial_order.h>
+#include <__config>
+#include <__utility/forward.h>
+#include <__utility/priority_tag.h>
+#include <type_traits>
+
+#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+// [cmp.alg]
+namespace __compare_partial_order_fallback {
+ struct __fn {
+ template<class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
+ noexcept(noexcept(_VSTD::partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))
+ -> decltype( _VSTD::partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))
+ { return _VSTD::partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); }
+
+ template<class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
+ noexcept(noexcept(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? partial_ordering::equivalent :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? partial_ordering::less :
+ _VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t) ? partial_ordering::greater :
+ partial_ordering::unordered))
+ -> decltype( _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? partial_ordering::equivalent :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? partial_ordering::less :
+ _VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t) ? partial_ordering::greater :
+ partial_ordering::unordered)
+ {
+ return _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? partial_ordering::equivalent :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? partial_ordering::less :
+ _VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t) ? partial_ordering::greater :
+ partial_ordering::unordered;
+ }
+
+ template<class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype( __go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>()))
+ { return __go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>()); }
+ };
+} // namespace __compare_partial_order_fallback
+
+inline namespace __cpo {
+ inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{};
+} // namespace __cpo
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK
diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/compare_strong_order_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__compare/compare_strong_order_fallback.h
new file mode 100644
index 0000000000..5fee7b4780
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__compare/compare_strong_order_fallback.h
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___COMPARE_COMPARE_STRONG_ORDER_FALLBACK
+#define _LIBCPP___COMPARE_COMPARE_STRONG_ORDER_FALLBACK
+
+#include <__compare/ordering.h>
+#include <__compare/strong_order.h>
+#include <__config>
+#include <__utility/forward.h>
+#include <__utility/priority_tag.h>
+#include <type_traits>
+
+#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+// [cmp.alg]
+namespace __compare_strong_order_fallback {
+ struct __fn {
+ template<class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
+ noexcept(noexcept(_VSTD::strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))
+ -> decltype( _VSTD::strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))
+ { return _VSTD::strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); }
+
+ template<class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
+ noexcept(noexcept(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? strong_ordering::equal :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? strong_ordering::less :
+ strong_ordering::greater))
+ -> decltype( _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? strong_ordering::equal :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? strong_ordering::less :
+ strong_ordering::greater)
+ {
+ return _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? strong_ordering::equal :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? strong_ordering::less :
+ strong_ordering::greater;
+ }
+
+ template<class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype( __go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>()))
+ { return __go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>()); }
+ };
+} // namespace __compare_strong_order_fallback
+
+inline namespace __cpo {
+ inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{};
+} // namespace __cpo
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___COMPARE_COMPARE_STRONG_ORDER_FALLBACK
diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/compare_weak_order_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__compare/compare_weak_order_fallback.h
new file mode 100644
index 0000000000..0abd4f2dfb
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__compare/compare_weak_order_fallback.h
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___COMPARE_COMPARE_WEAK_ORDER_FALLBACK
+#define _LIBCPP___COMPARE_COMPARE_WEAK_ORDER_FALLBACK
+
+#include <__compare/ordering.h>
+#include <__compare/weak_order.h>
+#include <__config>
+#include <__utility/forward.h>
+#include <__utility/priority_tag.h>
+#include <type_traits>
+
+#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+// [cmp.alg]
+namespace __compare_weak_order_fallback {
+ struct __fn {
+ template<class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
+ noexcept(noexcept(_VSTD::weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))
+ -> decltype( _VSTD::weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))
+ { return _VSTD::weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)); }
+
+ template<class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
+ noexcept(noexcept(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? weak_ordering::equivalent :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? weak_ordering::less :
+ weak_ordering::greater))
+ -> decltype( _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? weak_ordering::equivalent :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? weak_ordering::less :
+ weak_ordering::greater)
+ {
+ return _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u) ? weak_ordering::equivalent :
+ _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u) ? weak_ordering::less :
+ weak_ordering::greater;
+ }
+
+ template<class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype( __go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>()))
+ { return __go(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u), __priority_tag<1>()); }
+ };
+} // namespace __compare_weak_order_fallback
+
+inline namespace __cpo {
+ inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{};
+} // namespace __cpo
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___COMPARE_COMPARE_WEAK_ORDER_FALLBACK
diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h
index ec68967106..795b0bd749 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/convertible_to.h
@@ -10,6 +10,7 @@
#define _LIBCPP___CONCEPTS_CONVERTIBLE_TO_H
#include <__config>
+#include <__utility/declval.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -25,8 +26,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template<class _From, class _To>
concept convertible_to =
is_convertible_v<_From, _To> &&
- requires (add_rvalue_reference_t<_From> (&__f)()) {
- static_cast<_To>(__f());
+ requires {
+ static_cast<_To>(declval<_From>());
};
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h
index 423b3a89fa..d452497385 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h
@@ -28,13 +28,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
// [concept.swappable]
-namespace ranges::__swap {
- // Deleted to inhibit ADL
+
+namespace ranges {
+namespace __swap {
+
template<class _Tp>
void swap(_Tp&, _Tp&) = delete;
-
- // [1]
template<class _Tp, class _Up>
concept __unqualified_swappable_with =
(__class_or_enum<remove_cvref_t<_Tp>> || __class_or_enum<remove_cvref_t<_Up>>) &&
@@ -89,11 +89,12 @@ namespace ranges::__swap {
__y = _VSTD::exchange(__x, _VSTD::move(__y));
}
};
-} // namespace ranges::__swap
+} // namespace __swap
-namespace ranges::inline __cpo {
+inline namespace __cpo {
inline constexpr auto swap = __swap::__fn{};
-} // namespace ranges::__cpo
+} // namespace __cpo
+} // namespace ranges
template<class _Tp>
concept swappable = requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); };
diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config
index 7dce92dad0..ecf52e1a5f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__config
+++ b/contrib/libs/cxxsupp/libcxx/include/__config
@@ -140,6 +140,8 @@
// compatible. This switch removes these workarounds for platforms that don't care
// about ABI compatibility.
# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT
+// Remove basic_string common base
+# define _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
#elif _LIBCPP_ABI_VERSION == 1
# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
// Enable compiling copies of now inline methods into the dylib to support
@@ -1306,8 +1308,9 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
# if defined(__clang__) && __has_attribute(acquire_capability)
// Work around the attribute handling in clang. When both __declspec and
// __attribute__ are present, the processing goes awry preventing the definition
-// of the types.
-# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
+// of the types. In MinGW mode, __declspec evaluates to __attribute__, and thus
+// combining the two does work.
+# if !defined(_MSC_VER)
# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
# endif
# endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h
index e1e4abd80c..d04d51568b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h
@@ -34,25 +34,16 @@ public:
private:
type* __f_;
-#ifndef _LIBCPP_CXX03_LANG
static void __fun(_Tp&) _NOEXCEPT;
static void __fun(_Tp&&) = delete;
-#endif
public:
- // construct/copy/destroy
-#ifdef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
- reference_wrapper(type& __f) _NOEXCEPT
- : __f_(_VSTD::addressof(__f)) {}
-#else
- template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(declval<_Up>())) >>
+ template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(declval<_Up>())) > >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(declval<_Up>()))) {
type& __f = static_cast<_Up&&>(__u);
__f_ = _VSTD::addressof(__f);
}
-#endif
// access
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
@@ -176,7 +167,7 @@ public:
#endif // _LIBCPP_CXX03_LANG
};
-#if _LIBCPP_STD_VER >= 17
+#if _LIBCPP_STD_VER > 14
template <class _Tp>
reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
#endif
@@ -194,7 +185,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
reference_wrapper<_Tp>
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
- return _VSTD::ref(__t.get());
+ return __t;
}
template <class _Tp>
@@ -210,13 +201,11 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
reference_wrapper<const _Tp>
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
- return _VSTD::cref(__t.get());
+ return __t;
}
-#ifndef _LIBCPP_CXX03_LANG
template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&&) = delete;
-#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h
index 90c7fb4731..b8a7f6b580 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h
@@ -73,12 +73,6 @@ namespace __advance {
struct __fn {
private:
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr _Tp __magnitude_geq(_Tp __a, _Tp __b) noexcept {
- return __a < 0 ? (__a <= __b) : (__a >= __b);
- }
-
template <class _Ip>
_LIBCPP_HIDE_FROM_ABI
static constexpr void __advance_forward(_Ip& __i, iter_difference_t<_Ip> __n) {
@@ -154,7 +148,12 @@ public:
"If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true.");
// If `S` and `I` model `sized_sentinel_for<S, I>`:
if constexpr (sized_sentinel_for<_Sp, _Ip>) {
- // If |n| >= |bound - i|, equivalent to `ranges::advance(i, bound)`.
+ // __magnitude_geq(a, b) returns |a| >= |b|, assuming they have the same sign.
+ auto __magnitude_geq = [](auto __a, auto __b) {
+ return __a == 0 ? __b == 0 :
+ __a > 0 ? __a >= __b :
+ __a <= __b;
+ };
if (const auto __M = ___bound - __i; __magnitude_geq(__n, __M)) {
(*this)(__i, ___bound);
return __n - __M;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h
index df4c7bd18e..605071d709 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h
@@ -29,6 +29,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RANGES)
+template<class _Iter>
+concept __can_use_postfix_proxy =
+ constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> &&
+ move_constructible<iter_value_t<_Iter>>;
+
template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
requires (!same_as<_Iter, _Sent> && copyable<_Iter>)
class common_iterator {
@@ -54,10 +59,6 @@ class common_iterator {
: __value(_VSTD::forward<iter_reference_t<_Iter>>(__x)) {}
public:
- constexpr static bool __valid_for_iter =
- constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> &&
- move_constructible<iter_value_t<_Iter>>;
-
constexpr const iter_value_t<_Iter>& operator*() const noexcept {
return __value;
}
@@ -148,7 +149,7 @@ public:
++*this;
return __tmp;
} else if constexpr (requires (_Iter& __i) { { *__i++ } -> __referenceable; } ||
- !__postfix_proxy::__valid_for_iter) {
+ !__can_use_postfix_proxy<_Iter>) {
return _VSTD::__unchecked_get<_Iter>(__hold_)++;
} else {
__postfix_proxy __p(**this);
@@ -261,7 +262,7 @@ struct __arrow_type_or_void<_Iter, _Sent> {
using type = decltype(declval<const common_iterator<_Iter, _Sent>&>().operator->());
};
-template<class _Iter, class _Sent>
+template<input_iterator _Iter, class _Sent>
struct iterator_traits<common_iterator<_Iter, _Sent>> {
using iterator_concept = _If<forward_iterator<_Iter>,
forward_iterator_tag,
@@ -275,7 +276,6 @@ struct iterator_traits<common_iterator<_Iter, _Sent>> {
using reference = iter_reference_t<_Iter>;
};
-
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h
index 22af2efffa..12ea8bd400 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h
@@ -96,7 +96,7 @@ public:
}
_LIBCPP_HIDE_FROM_ABI
- constexpr const _Iter& base() const& { return __current_; }
+ constexpr const _Iter& base() const& noexcept { return __current_; }
_LIBCPP_HIDE_FROM_ABI
constexpr _Iter base() && { return _VSTD::move(__current_); }
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_move.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_move.h
index a2951f764b..b72a5ec448 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_move.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_move.h
@@ -25,7 +25,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RANGES)
-namespace ranges::__iter_move {
+// [iterator.cust.move]
+
+namespace ranges {
+namespace __iter_move {
+
void iter_move();
template<class _Ip>
@@ -69,14 +73,15 @@ struct __fn {
// [iterator.cust.move]/1.3
// Otherwise, ranges::iter_move(E) is ill-formed.
};
-} // namespace ranges::__iter_move
+} // namespace __iter_move
-namespace ranges::inline __cpo {
+inline namespace __cpo {
inline constexpr auto iter_move = __iter_move::__fn{};
-}
+} // namespace __cpo
+} // namespace ranges
template<__dereferenceable _Tp>
-requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __referenceable; }
+ requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __referenceable; }
using iter_rvalue_reference_t = decltype(ranges::iter_move(declval<_Tp&>()));
#endif // !_LIBCPP_HAS_NO_RANGES
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_swap.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_swap.h
index a6c3bc8c66..d8fff5eb54 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_swap.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iter_swap.h
@@ -28,6 +28,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RANGES)
+// [iter.cust.swap]
+
namespace ranges {
namespace __iter_swap {
template<class _I1, class _I2>
@@ -79,12 +81,11 @@ namespace __iter_swap {
*_VSTD::forward<_T1>(__x) = _VSTD::move(__old);
}
};
-} // end namespace __iter_swap
+} // namespace __iter_swap
inline namespace __cpo {
inline constexpr auto iter_swap = __iter_swap::__fn{};
} // namespace __cpo
-
} // namespace ranges
template<class _I1, class _I2 = _I1>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h
index 306ce240ba..29bac864c2 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h
@@ -12,6 +12,7 @@
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__utility/move.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -53,7 +54,7 @@ public:
move_iterator() : __current_() {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
- explicit move_iterator(_Iter __i) : __current_(__i) {}
+ explicit move_iterator(_Iter __i) : __current_(_VSTD::move(__i)) {}
template <class _Up, class = __enable_if_t<
!is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value
@@ -176,7 +177,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
move_iterator<_Iter>
make_move_iterator(_Iter __i)
{
- return move_iterator<_Iter>(__i);
+ return move_iterator<_Iter>(_VSTD::move(__i));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h
index 454054534e..449eb529aa 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h
@@ -77,7 +77,7 @@ public:
template <class _Up, class = __enable_if_t<
!is_same<_Up, _Iter>::value &&
is_convertible<_Up const&, _Iter>::value &&
- is_assignable<_Iter, _Up const&>::value
+ is_assignable<_Iter&, _Up const&>::value
> >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
@@ -102,7 +102,7 @@ public:
template <class _Up, class = __enable_if_t<
!is_same<_Up, _Iter>::value &&
is_convertible<_Up const&, _Iter>::value &&
- is_assignable<_Iter, _Up const&>::value
+ is_assignable<_Iter&, _Up const&>::value
> >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h
index bf27af6627..1a08779956 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h
@@ -31,25 +31,24 @@ public:
// types
typedef uint32_t result_type;
-private:
- vector<result_type> __v_;
-
- template<class _InputIterator>
- void init(_InputIterator __first, _InputIterator __last);
-public:
// constructors
_LIBCPP_INLINE_VISIBILITY
seed_seq() _NOEXCEPT {}
#ifndef _LIBCPP_CXX03_LANG
- template<class _Tp>
- _LIBCPP_INLINE_VISIBILITY
- seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());}
+ template<class _Tp, __enable_if_t<is_integral<_Tp>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ seed_seq(initializer_list<_Tp> __il) {
+ __init(__il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
template<class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- seed_seq(_InputIterator __first, _InputIterator __last)
- {init(__first, __last);}
+ _LIBCPP_INLINE_VISIBILITY
+ seed_seq(_InputIterator __first, _InputIterator __last) {
+ static_assert(is_integral<typename iterator_traits<_InputIterator>::value_type>::value,
+ "Mandates: iterator_traits<InputIterator>::value_type is an integer type");
+ __init(__first, __last);
+ }
// generating functions
template<class _RandomAccessIterator>
@@ -68,11 +67,17 @@ public:
_LIBCPP_INLINE_VISIBILITY
static result_type _Tp(result_type __x) {return __x ^ (__x >> 27);}
+
+private:
+ template<class _InputIterator>
+ void __init(_InputIterator __first, _InputIterator __last);
+
+ vector<result_type> __v_;
};
template<class _InputIterator>
void
-seed_seq::init(_InputIterator __first, _InputIterator __last)
+seed_seq::__init(_InputIterator __first, _InputIterator __last)
{
for (_InputIterator __s = __first; __s != __last; ++__s)
__v_.push_back(*__s & 0xFFFFFFFF);
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/empty_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/empty_view.h
index 4a98a6f324..f744dcbe92 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/empty_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/empty_view.h
@@ -10,6 +10,7 @@
#define _LIBCPP___RANGES_EMPTY_VIEW_H
#include <__config>
+#include <__ranges/enable_borrowed_range.h>
#include <__ranges/view_interface.h>
#include <type_traits>
@@ -32,6 +33,9 @@ namespace ranges {
_LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
_LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
};
+
+ template<class _Tp>
+ inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
} // namespace ranges
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h
index e1daec046f..70b2174e93 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h
@@ -38,7 +38,7 @@ template <class _Tp>
inline constexpr bool enable_view = derived_from<_Tp, view_base> ||
requires { ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr); };
-} // end namespace ranges
+} // namespace ranges
#endif // !_LIBCPP_HAS_NO_RANGES
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h
index 7567ac48f2..283fa2599b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/ref_view.h
@@ -18,6 +18,7 @@
#include <__ranges/concepts.h>
#include <__ranges/data.h>
#include <__ranges/empty.h>
+#include <__ranges/enable_borrowed_range.h>
#include <__ranges/size.h>
#include <__ranges/view_interface.h>
#include <__utility/forward.h>
@@ -74,6 +75,8 @@ public:
template<class _Range>
ref_view(_Range&) -> ref_view<_Range>;
+ template<class _Tp>
+ inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
} // namespace ranges
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h
index 76adbffef6..f85563a6c2 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h
@@ -40,12 +40,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template<class _From, class _To>
+ concept __uses_nonqualification_pointer_conversion =
+ is_pointer_v<_From> && is_pointer_v<_To> &&
+ !convertible_to<remove_pointer_t<_From>(*)[], remove_pointer_t<_To>(*)[]>;
+
+ template<class _From, class _To>
concept __convertible_to_non_slicing =
convertible_to<_From, _To> &&
- // If they're both pointers, they must have the same element type.
- !(is_pointer_v<decay_t<_From>> &&
- is_pointer_v<decay_t<_To>> &&
- __different_from<remove_pointer_t<decay_t<_From>>, remove_pointer_t<decay_t<_To>>>);
+ !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>;
template<class _Tp>
concept __pair_like =
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h
index 020f51af8c..65526ff0a1 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h
@@ -195,9 +195,7 @@ public:
: __parent_(__i.__parent_), __current_(_VSTD::move(__i.__current_)) {}
_LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_Base> base() const&
- requires copyable<iterator_t<_Base>>
- {
+ constexpr const iterator_t<_Base>& base() const& noexcept {
return __current_;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/atomic b/contrib/libs/cxxsupp/libcxx/include/atomic
index 89f3c0a1de..0de7bf7fdb 100644
--- a/contrib/libs/cxxsupp/libcxx/include/atomic
+++ b/contrib/libs/cxxsupp/libcxx/include/atomic
@@ -2727,10 +2727,13 @@ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::typ
typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free;
#else
// No signed/unsigned lock-free types
+#define _LIBCPP_NO_LOCK_FREE_TYPES
#endif
+#if !defined(_LIBCPP_NO_LOCK_FREE_TYPES)
typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free;
typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free;
+#endif
#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v}
diff --git a/contrib/libs/cxxsupp/libcxx/include/compare b/contrib/libs/cxxsupp/libcxx/include/compare
index d686b5a369..287e61690b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/compare
+++ b/contrib/libs/cxxsupp/libcxx/include/compare
@@ -51,9 +51,14 @@ namespace std {
struct compare_three_way; // C++20
// [cmp.alg], comparison algorithms
- template<class T> constexpr strong_ordering strong_order(const T& a, const T& b);
- template<class T> constexpr weak_ordering weak_order(const T& a, const T& b);
- template<class T> constexpr partial_ordering partial_order(const T& a, const T& b);
+ inline namespace unspecified {
+ inline constexpr unspecified strong_order = unspecified;
+ inline constexpr unspecified weak_order = unspecified;
+ inline constexpr unspecified partial_order = unspecified;
+ inline constexpr unspecified compare_strong_order_fallback = unspecified;
+ inline constexpr unspecified compare_weak_order_fallback = unspecified;
+ inline constexpr unspecified compare_partial_order_fallback = unspecified;
+ }
// [cmp.partialord], Class partial_ordering
class partial_ordering {
@@ -136,8 +141,11 @@ namespace std {
*/
#include <__compare/common_comparison_category.h>
+#include <__compare/compare_partial_order_fallback.h>
+#include <__compare/compare_strong_order_fallback.h>
#include <__compare/compare_three_way.h>
#include <__compare/compare_three_way_result.h>
+#include <__compare/compare_weak_order_fallback.h>
#include <__compare/is_eq.h>
#include <__compare/ordering.h>
#include <__compare/partial_order.h>
diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap b/contrib/libs/cxxsupp/libcxx/include/module.modulemap
index 90fae9bb83..fc05f6c666 100644
--- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap
+++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap
@@ -385,16 +385,19 @@ module std [system] {
export *
module __compare {
- module common_comparison_category { private header "__compare/common_comparison_category.h" }
- module compare_three_way { private header "__compare/compare_three_way.h" }
- module compare_three_way_result { private header "__compare/compare_three_way_result.h" }
- module is_eq { private header "__compare/is_eq.h" }
- module ordering { private header "__compare/ordering.h" }
- module partial_order { private header "__compare/partial_order.h" }
- module strong_order { private header "__compare/strong_order.h" }
- module synth_three_way { private header "__compare/synth_three_way.h" }
- module three_way_comparable { private header "__compare/three_way_comparable.h" }
- module weak_order { private header "__compare/weak_order.h" }
+ module common_comparison_category { private header "__compare/common_comparison_category.h" }
+ module compare_partial_order_fallback { private header "__compare/compare_partial_order_fallback.h" }
+ module compare_strong_order_fallback { private header "__compare/compare_strong_order_fallback.h" }
+ module compare_three_way { private header "__compare/compare_three_way.h" }
+ module compare_three_way_result { private header "__compare/compare_three_way_result.h" }
+ module compare_weak_order_fallback { private header "__compare/compare_weak_order_fallback.h" }
+ module is_eq { private header "__compare/is_eq.h" }
+ module ordering { private header "__compare/ordering.h" }
+ module partial_order { private header "__compare/partial_order.h" }
+ module strong_order { private header "__compare/strong_order.h" }
+ module synth_three_way { private header "__compare/synth_three_way.h" }
+ module three_way_comparable { private header "__compare/three_way_comparable.h" }
+ module weak_order { private header "__compare/weak_order.h" }
}
}
module complex {
diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string
index 50578ef989..457a393804 100644
--- a/contrib/libs/cxxsupp/libcxx/include/string
+++ b/contrib/libs/cxxsupp/libcxx/include/string
@@ -622,6 +622,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
+#ifndef _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
template <bool>
struct __basic_string_common;
@@ -631,6 +632,7 @@ struct __basic_string_common<true> {
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_length_error() const;
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_out_of_range() const;
};
+#endif
template <class _Iter>
struct __string_is_trivial_iterator : public false_type {};
@@ -684,7 +686,9 @@ class
_LIBCPP_PREFERRED_NAME(u32string)
#endif
basic_string
+#ifndef _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
: private __basic_string_common<true> // This base class is historical, but it needs to remain for ABI compatibility
+#endif
{
static_assert(sizeof(_CharT) <= 4, "libc++ implementation of std::basic_string does not support extra-wide character types");
public:
@@ -1761,20 +1765,12 @@ private:
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
void __throw_length_error() const {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- __basic_string_common<true>::__throw_length_error();
-#else
- _VSTD::abort();
-#endif
+ _VSTD::__throw_length_error("basic_string");
}
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
void __throw_out_of_range() const {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- __basic_string_common<true>::__throw_out_of_range();
-#else
- _VSTD::abort();
-#endif
+ _VSTD::__throw_out_of_range("basic_string");
}
friend basic_string operator+<>(const basic_string&, const basic_string&);
@@ -1898,7 +1894,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
size_type __reserve)
{
if (__reserve > max_size())
- this->__throw_length_error();
+ __throw_length_error();
pointer __p;
if (__fits_in_sso(__reserve))
{
@@ -1922,7 +1918,7 @@ void
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
{
if (__sz > max_size())
- this->__throw_length_error();
+ __throw_length_error();
pointer __p;
if (__fits_in_sso(__sz))
{
@@ -2005,7 +2001,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
__set_short_size(__sz);
} else {
if (__sz > max_size())
- this->__throw_length_error();
+ __throw_length_error();
size_t __cap = __recommend(__sz);
__p = __alloc_traits::allocate(__alloc(), __cap + 1);
__set_long_pointer(__p);
@@ -2061,7 +2057,7 @@ void
basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
{
if (__n > max_size())
- this->__throw_length_error();
+ __throw_length_error();
pointer __p;
if (__fits_in_sso(__n))
{
@@ -2106,7 +2102,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
{
size_type __str_sz = __str.size();
if (__pos > __str_sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
__init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos));
_VSTD::__debug_db_insert_c(this);
}
@@ -2119,7 +2115,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
{
size_type __str_sz = __str.size();
if (__pos > __str_sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
__init(__str.data() + __pos, __str_sz - __pos);
_VSTD::__debug_db_insert_c(this);
}
@@ -2192,7 +2188,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
{
size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
if (__sz > max_size())
- this->__throw_length_error();
+ __throw_length_error();
pointer __p;
if (__fits_in_sso(__sz))
{
@@ -2291,7 +2287,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
{
size_type __ms = max_size();
if (__delta_cap > __ms - __old_cap - 1)
- this->__throw_length_error();
+ __throw_length_error();
pointer __old_p = __get_pointer();
size_type __cap = __old_cap < __ms / 2 - __alignment ?
__recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
@@ -2323,7 +2319,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
{
size_type __ms = max_size();
if (__delta_cap > __ms - __old_cap)
- this->__throw_length_error();
+ __throw_length_error();
pointer __old_p = __get_pointer();
size_type __cap = __old_cap < __ms / 2 - __alignment ?
__recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
@@ -2555,7 +2551,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, siz
{
size_type __sz = __str.size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return assign(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
}
@@ -2572,7 +2568,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp & __t, size_type __p
__self_view __sv = __t;
size_type __sz = __sv.size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return assign(__sv.data() + __pos, _VSTD::min(__n, __sz - __pos));
}
@@ -2741,7 +2737,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, siz
{
size_type __sz = __str.size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return append(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
}
@@ -2757,7 +2753,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const _Tp & __t, size_type __p
__self_view __sv = __t;
size_type __sz = __sv.size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return append(__sv.data() + __pos, _VSTD::min(__n, __sz - __pos));
}
@@ -2778,7 +2774,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr");
size_type __sz = size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
size_type __cap = capacity();
if (__cap - __sz >= __n)
{
@@ -2809,7 +2805,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
{
size_type __sz = size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
if (__n)
{
size_type __cap = capacity();
@@ -2915,7 +2911,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_
{
size_type __str_sz = __str.size();
if (__pos2 > __str_sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return insert(__pos1, __str.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2));
}
@@ -2932,7 +2928,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& _
__self_view __sv = __t;
size_type __str_sz = __sv.size();
if (__pos2 > __str_sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return insert(__pos1, __sv.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2));
}
@@ -2993,7 +2989,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
size_type __sz = size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
__n1 = _VSTD::min(__n1, __sz - __pos);
size_type __cap = capacity();
if (__cap - __sz + __n1 >= __n2)
@@ -3040,7 +3036,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
{
size_type __sz = size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
__n1 = _VSTD::min(__n1, __sz - __pos);
size_type __cap = capacity();
value_type* __p;
@@ -3074,7 +3070,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
_InputIterator __j1, _InputIterator __j2)
{
const basic_string __temp(__j1, __j2, __alloc());
- return this->replace(__i1, __i2, __temp);
+ return replace(__i1, __i2, __temp);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3092,7 +3088,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _
{
size_type __str_sz = __str.size();
if (__pos2 > __str_sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return replace(__pos1, __n1, __str.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2));
}
@@ -3109,7 +3105,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _
__self_view __sv = __t;
size_type __str_sz = __sv.size();
if (__pos2 > __str_sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
return replace(__pos1, __n1, __sv.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2));
}
@@ -3179,7 +3175,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,
size_type __n) {
- if (__pos > size()) this->__throw_out_of_range();
+ if (__pos > size())
+ __throw_out_of_range();
if (__n == npos) {
__erase_to_end(__pos);
} else {
@@ -3295,12 +3292,13 @@ void
basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity)
{
if (__requested_capacity > max_size())
- this->__throw_length_error();
+ __throw_length_error();
-#if _LIBCPP_STD_VER > 17
- // Reserve never shrinks as of C++20.
- if (__requested_capacity <= capacity()) return;
-#endif
+ // Make sure reserve(n) never shrinks. This is technically only required in C++20
+ // and later (since P0966R1), however we provide consistent behavior in all Standard
+ // modes because this function is instantiated in the shared library.
+ if (__requested_capacity <= capacity())
+ return;
size_type __target_capacity = _VSTD::max(__requested_capacity, size());
__target_capacity = __recommend(__target_capacity);
@@ -3401,7 +3399,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::const_reference
basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
{
if (__n >= size())
- this->__throw_out_of_range();
+ __throw_out_of_range();
return (*this)[__n];
}
@@ -3410,7 +3408,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::reference
basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
{
if (__n >= size())
- this->__throw_out_of_range();
+ __throw_out_of_range();
return (*this)[__n];
}
@@ -3456,7 +3454,7 @@ basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n,
{
size_type __sz = size();
if (__pos > __sz)
- this->__throw_out_of_range();
+ __throw_out_of_range();
size_type __rlen = _VSTD::min(__n, __sz - __pos);
traits_type::copy(__s, data() + __pos, __rlen);
return __rlen;
@@ -3900,7 +3898,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
size_type __sz = size();
if (__pos1 > __sz || __n2 == npos)
- this->__throw_out_of_range();
+ __throw_out_of_range();
size_type __rlen = _VSTD::min(__n1, __sz - __pos1);
int __r = traits_type::compare(data() + __pos1, __s, _VSTD::min(__rlen, __n2));
if (__r == 0)
@@ -3964,7 +3962,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
size_type __pos2,
size_type __n2) const
{
- return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
+ return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -4478,16 +4476,16 @@ template<class _CharT, class _Traits, class _Allocator>
bool
basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const
{
- return this->data() <= _VSTD::__to_address(__i->base()) &&
- _VSTD::__to_address(__i->base()) < this->data() + this->size();
+ return data() <= _VSTD::__to_address(__i->base()) &&
+ _VSTD::__to_address(__i->base()) < data() + size();
}
template<class _CharT, class _Traits, class _Allocator>
bool
basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const
{
- return this->data() < _VSTD::__to_address(__i->base()) &&
- _VSTD::__to_address(__i->base()) <= this->data() + this->size();
+ return data() < _VSTD::__to_address(__i->base()) &&
+ _VSTD::__to_address(__i->base()) <= data() + size();
}
template<class _CharT, class _Traits, class _Allocator>
@@ -4495,7 +4493,7 @@ bool
basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
{
const value_type* __p = _VSTD::__to_address(__i->base()) + __n;
- return this->data() <= __p && __p <= this->data() + this->size();
+ return data() <= __p && __p <= data() + size();
}
template<class _CharT, class _Traits, class _Allocator>
@@ -4503,7 +4501,7 @@ bool
basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{
const value_type* __p = _VSTD::__to_address(__i->base()) + __n;
- return this->data() <= __p && __p < this->data() + this->size();
+ return data() <= __p && __p < data() + size();
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp b/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp
index de7ded4514..fa793f6829 100644
--- a/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp
+++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp
@@ -9,97 +9,12 @@
#include "__config"
#include "filesystem"
#include "stack"
-#if defined(_LIBCPP_WIN32API)
-#define WIN32_LEAN_AND_MEAN
-#define NOMINMAX
-#include <windows.h>
-#else
-#include <dirent.h>
-#endif
#include <errno.h>
#include "filesystem_common.h"
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-namespace detail {
-namespace {
-
-#if !defined(_LIBCPP_WIN32API)
-
-#if defined(DT_BLK)
-template <class DirEntT, class = decltype(DirEntT::d_type)>
-static file_type get_file_type(DirEntT* ent, int) {
- switch (ent->d_type) {
- case DT_BLK:
- return file_type::block;
- case DT_CHR:
- return file_type::character;
- case DT_DIR:
- return file_type::directory;
- case DT_FIFO:
- return file_type::fifo;
- case DT_LNK:
- return file_type::symlink;
- case DT_REG:
- return file_type::regular;
- case DT_SOCK:
- return file_type::socket;
- // Unlike in lstat, hitting "unknown" here simply means that the underlying
- // filesystem doesn't support d_type. Report is as 'none' so we correctly
- // set the cache to empty.
- case DT_UNKNOWN:
- break;
- }
- return file_type::none;
-}
-#endif // defined(DT_BLK)
-
-template <class DirEntT>
-static file_type get_file_type(DirEntT*, long) {
- return file_type::none;
-}
-
-static pair<string_view, file_type> posix_readdir(DIR* dir_stream,
- error_code& ec) {
- struct dirent* dir_entry_ptr = nullptr;
- errno = 0; // zero errno in order to detect errors
- ec.clear();
- if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) {
- if (errno)
- ec = capture_errno();
- return {};
- } else {
- return {dir_entry_ptr->d_name, get_file_type(dir_entry_ptr, 0)};
- }
-}
-#else
-// defined(_LIBCPP_WIN32API)
-
-static file_type get_file_type(const WIN32_FIND_DATAW& data) {
- if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
- data.dwReserved0 == IO_REPARSE_TAG_SYMLINK)
- return file_type::symlink;
- if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- return file_type::directory;
- return file_type::regular;
-}
-static uintmax_t get_file_size(const WIN32_FIND_DATAW& data) {
- return (static_cast<uint64_t>(data.nFileSizeHigh) << 32) + data.nFileSizeLow;
-}
-static file_time_type get_write_time(const WIN32_FIND_DATAW& data) {
- ULARGE_INTEGER tmp;
- const FILETIME& time = data.ftLastWriteTime;
- tmp.u.LowPart = time.dwLowDateTime;
- tmp.u.HighPart = time.dwHighDateTime;
- return file_time_type(file_time_type::duration(tmp.QuadPart));
-}
-
-#endif
-
-} // namespace
-} // namespace detail
-
using detail::ErrorHandler;
#if defined(_LIBCPP_WIN32API)
@@ -197,9 +112,9 @@ public:
: __stream_(nullptr), __root_(root) {
if ((__stream_ = ::opendir(root.c_str())) == nullptr) {
ec = detail::capture_errno();
- const bool allow_eacess =
+ const bool allow_eacces =
bool(opts & directory_options::skip_permission_denied);
- if (allow_eacess && ec.value() == EACCES)
+ if (allow_eacces && ec.value() == EACCES)
ec.clear();
return;
}
diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h
index a3642df448..b693476518 100644
--- a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h
+++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h
@@ -20,12 +20,19 @@
#include "ratio"
#include "system_error"
+#if defined(_LIBCPP_WIN32API)
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <windows.h>
+#endif
+
#if !defined(_LIBCPP_WIN32API)
-# include <unistd.h>
+# include <dirent.h> // for DIR & friends
+# include <fcntl.h> /* values for fchmodat */
# include <sys/stat.h>
# include <sys/statvfs.h>
# include <sys/time.h> // for ::utimes as used in __last_write_time
-# include <fcntl.h> /* values for fchmodat */
+# include <unistd.h>
#endif
#include "../include/apple_availability.h"
@@ -537,7 +544,76 @@ bool set_file_times(const path& p, std::array<TimeSpec, 2> const& TS,
return posix_utimensat(p, TS, ec);
#endif
}
-#endif /* !_LIBCPP_WIN32API */
+
+#if defined(DT_BLK)
+template <class DirEntT, class = decltype(DirEntT::d_type)>
+static file_type get_file_type(DirEntT* ent, int) {
+ switch (ent->d_type) {
+ case DT_BLK:
+ return file_type::block;
+ case DT_CHR:
+ return file_type::character;
+ case DT_DIR:
+ return file_type::directory;
+ case DT_FIFO:
+ return file_type::fifo;
+ case DT_LNK:
+ return file_type::symlink;
+ case DT_REG:
+ return file_type::regular;
+ case DT_SOCK:
+ return file_type::socket;
+ // Unlike in lstat, hitting "unknown" here simply means that the underlying
+ // filesystem doesn't support d_type. Report is as 'none' so we correctly
+ // set the cache to empty.
+ case DT_UNKNOWN:
+ break;
+ }
+ return file_type::none;
+}
+#endif // defined(DT_BLK)
+
+template <class DirEntT>
+static file_type get_file_type(DirEntT*, long) {
+ return file_type::none;
+}
+
+static pair<string_view, file_type> posix_readdir(DIR* dir_stream,
+ error_code& ec) {
+ struct dirent* dir_entry_ptr = nullptr;
+ errno = 0; // zero errno in order to detect errors
+ ec.clear();
+ if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) {
+ if (errno)
+ ec = capture_errno();
+ return {};
+ } else {
+ return {dir_entry_ptr->d_name, get_file_type(dir_entry_ptr, 0)};
+ }
+}
+
+#else // _LIBCPP_WIN32API
+
+static file_type get_file_type(const WIN32_FIND_DATAW& data) {
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
+ data.dwReserved0 == IO_REPARSE_TAG_SYMLINK)
+ return file_type::symlink;
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ return file_type::directory;
+ return file_type::regular;
+}
+static uintmax_t get_file_size(const WIN32_FIND_DATAW& data) {
+ return (static_cast<uint64_t>(data.nFileSizeHigh) << 32) + data.nFileSizeLow;
+}
+static file_time_type get_write_time(const WIN32_FIND_DATAW& data) {
+ ULARGE_INTEGER tmp;
+ const FILETIME& time = data.ftLastWriteTime;
+ tmp.u.LowPart = time.dwLowDateTime;
+ tmp.u.HighPart = time.dwHighDateTime;
+ return file_time_type(file_time_type::duration(tmp.QuadPart));
+}
+
+#endif // !_LIBCPP_WIN32API
} // namespace
} // end namespace detail
diff --git a/contrib/libs/cxxsupp/libcxx/src/string.cpp b/contrib/libs/cxxsupp/libcxx/src/string.cpp
index 608dcb2c58..3c63f40824 100644
--- a/contrib/libs/cxxsupp/libcxx/src/string.cpp
+++ b/contrib/libs/cxxsupp/libcxx/src/string.cpp
@@ -21,6 +21,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+#ifndef _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
void __basic_string_common<true>::__throw_length_error() const {
_VSTD::__throw_length_error("basic_string");
}
@@ -28,6 +29,7 @@ void __basic_string_common<true>::__throw_length_error() const {
void __basic_string_common<true>::__throw_out_of_range() const {
_VSTD::__throw_out_of_range("basic_string");
}
+#endif
#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION