-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update contrib/restricted/abseil-cpp to 20250127.0
commit_hash:cb84f6cd1a663877e7f59ac994d08e04a1e76205
- Loading branch information
1 parent
25d2ab3
commit 1563bea
Showing
176 changed files
with
9,955 additions
and
1,386 deletions.
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_with_data.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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___ITERATOR_ITERATOR_WITH_DATA_H | ||
#define _LIBCPP___ITERATOR_ITERATOR_WITH_DATA_H | ||
|
||
#include <__compare/compare_three_way_result.h> | ||
#include <__compare/three_way_comparable.h> | ||
#include <__config> | ||
#include <__iterator/concepts.h> | ||
#include <__iterator/incrementable_traits.h> | ||
#include <__iterator/iter_move.h> | ||
#include <__iterator/iter_swap.h> | ||
#include <__iterator/iterator_traits.h> | ||
#include <__iterator/readable_traits.h> | ||
#include <__utility/move.h> | ||
|
||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
# pragma GCC system_header | ||
#endif | ||
|
||
_LIBCPP_PUSH_MACROS | ||
#include <__undef_macros> | ||
|
||
#if _LIBCPP_STD_VER >= 20 | ||
|
||
_LIBCPP_BEGIN_NAMESPACE_STD | ||
|
||
template <forward_iterator _Iterator, class _Data> | ||
class __iterator_with_data { | ||
_Iterator __iter_{}; | ||
_Data __data_{}; | ||
|
||
public: | ||
using value_type = iter_value_t<_Iterator>; | ||
using difference_type = iter_difference_t<_Iterator>; | ||
|
||
_LIBCPP_HIDE_FROM_ABI __iterator_with_data() = default; | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data(_Iterator __iter, _Data __data) | ||
: __iter_(std::move(__iter)), __data_(std::move(__data)) {} | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI _Iterator __get_iter() const { return __iter_; } | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI _Data __get_data() && { return std::move(__data_); } | ||
|
||
friend constexpr _LIBCPP_HIDE_FROM_ABI bool | ||
operator==(const __iterator_with_data& __lhs, const __iterator_with_data& __rhs) { | ||
return __lhs.__iter_ == __rhs.__iter_; | ||
} | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data& operator++() { | ||
++__iter_; | ||
return *this; | ||
} | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data operator++(int) { | ||
auto __tmp = *this; | ||
__iter_++; | ||
return __tmp; | ||
} | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data& operator--() | ||
requires bidirectional_iterator<_Iterator> | ||
{ | ||
--__iter_; | ||
return *this; | ||
} | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data operator--(int) | ||
requires bidirectional_iterator<_Iterator> | ||
{ | ||
auto __tmp = *this; | ||
--__iter_; | ||
return __tmp; | ||
} | ||
|
||
constexpr _LIBCPP_HIDE_FROM_ABI iter_reference_t<_Iterator> operator*() const { return *__iter_; } | ||
|
||
_LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iterator> | ||
iter_move(const __iterator_with_data& __iter) noexcept(noexcept(ranges::iter_move(__iter.__iter_))) { | ||
return ranges::iter_move(__iter.__iter_); | ||
} | ||
|
||
_LIBCPP_HIDE_FROM_ABI friend constexpr void | ||
iter_swap(const __iterator_with_data& __lhs, | ||
const __iterator_with_data& __rhs) noexcept(noexcept(ranges::iter_swap(__lhs.__iter_, __rhs.__iter_))) | ||
requires indirectly_swappable<_Iterator> | ||
{ | ||
return ranges::iter_swap(__lhs.__data_, __rhs.__iter_); | ||
} | ||
}; | ||
|
||
_LIBCPP_END_NAMESPACE_STD | ||
|
||
#endif // _LIBCPP_STD_VER >= 20 | ||
|
||
_LIBCPP_POP_MACROS | ||
|
||
#endif // _LIBCPP___ITERATOR_ITERATOR_WITH_DATA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// -*- C++ -*- | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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___RANGES_ALL_H | ||
#define _LIBCPP___RANGES_ALL_H | ||
|
||
#include <__config> | ||
#include <__functional/compose.h> // TODO(modules): Those should not be required | ||
#include <__functional/perfect_forward.h> // | ||
#include <__iterator/concepts.h> | ||
#include <__iterator/iterator_traits.h> | ||
#include <__ranges/access.h> | ||
#include <__ranges/concepts.h> | ||
#include <__ranges/owning_view.h> | ||
#include <__ranges/range_adaptor.h> | ||
#include <__ranges/ref_view.h> | ||
#include <__type_traits/decay.h> | ||
#include <__utility/auto_cast.h> | ||
#include <__utility/declval.h> | ||
#include <__utility/forward.h> | ||
|
||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
# pragma GCC system_header | ||
#endif | ||
|
||
_LIBCPP_BEGIN_NAMESPACE_STD | ||
|
||
#if _LIBCPP_STD_VER >= 20 | ||
|
||
namespace ranges::views { | ||
|
||
namespace __all { | ||
struct __fn : __range_adaptor_closure<__fn> { | ||
template <class _Tp> | ||
requires ranges::view<decay_t<_Tp>> | ||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const | ||
noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) | ||
-> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) { | ||
return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)); | ||
} | ||
|
||
template <class _Tp> | ||
requires(!ranges::view<decay_t<_Tp>>) && requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } | ||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const | ||
noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) { | ||
return ranges::ref_view{std::forward<_Tp>(__t)}; | ||
} | ||
|
||
template <class _Tp> | ||
requires( | ||
!ranges::view<decay_t<_Tp>> && !requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } && | ||
requires(_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; }) | ||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const | ||
noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) { | ||
return ranges::owning_view{std::forward<_Tp>(__t)}; | ||
} | ||
}; | ||
} // namespace __all | ||
|
||
inline namespace __cpo { | ||
inline constexpr auto all = __all::__fn{}; | ||
} // namespace __cpo | ||
|
||
template <ranges::viewable_range _Range> | ||
using all_t = decltype(views::all(std::declval<_Range>())); | ||
|
||
} // namespace ranges::views | ||
|
||
#endif // _LIBCPP_STD_VER >= 20 | ||
|
||
_LIBCPP_END_NAMESPACE_STD | ||
|
||
#endif // _LIBCPP___RANGES_ALL_H |
142 changes: 142 additions & 0 deletions
142
contrib/libs/cxxsupp/libcxx/include/__ranges/as_rvalue_view.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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___RANGES_AS_RVALUE_H | ||
#define _LIBCPP___RANGES_AS_RVALUE_H | ||
|
||
#include <__concepts/constructible.h> | ||
#include <__concepts/same_as.h> | ||
#include <__config> | ||
#include <__iterator/move_iterator.h> | ||
#include <__iterator/move_sentinel.h> | ||
#include <__ranges/access.h> | ||
#include <__ranges/all.h> | ||
#include <__ranges/concepts.h> | ||
#include <__ranges/enable_borrowed_range.h> | ||
#include <__ranges/range_adaptor.h> | ||
#include <__ranges/size.h> | ||
#include <__ranges/view_interface.h> | ||
#include <__utility/forward.h> | ||
#include <__utility/move.h> | ||
|
||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
# pragma GCC system_header | ||
#endif | ||
|
||
_LIBCPP_PUSH_MACROS | ||
#include <__undef_macros> | ||
|
||
#if _LIBCPP_STD_VER >= 23 | ||
|
||
_LIBCPP_BEGIN_NAMESPACE_STD | ||
|
||
namespace ranges { | ||
template <view _View> | ||
requires input_range<_View> | ||
class as_rvalue_view : public view_interface<as_rvalue_view<_View>> { | ||
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); | ||
|
||
public: | ||
_LIBCPP_HIDE_FROM_ABI as_rvalue_view() | ||
requires default_initializable<_View> | ||
= default; | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr explicit as_rvalue_view(_View __base) : __base_(std::move(__base)) {} | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr _View base() const& | ||
requires copy_constructible<_View> | ||
{ | ||
return __base_; | ||
} | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr auto begin() | ||
requires(!__simple_view<_View>) | ||
{ | ||
return move_iterator(ranges::begin(__base_)); | ||
} | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr auto begin() const | ||
requires range<const _View> | ||
{ | ||
return move_iterator(ranges::begin(__base_)); | ||
} | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr auto end() | ||
requires(!__simple_view<_View>) | ||
{ | ||
if constexpr (common_range<_View>) { | ||
return move_iterator(ranges::end(__base_)); | ||
} else { | ||
return move_sentinel(ranges::end(__base_)); | ||
} | ||
} | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr auto end() const | ||
requires range<const _View> | ||
{ | ||
if constexpr (common_range<const _View>) { | ||
return move_iterator(ranges::end(__base_)); | ||
} else { | ||
return move_sentinel(ranges::end(__base_)); | ||
} | ||
} | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr auto size() | ||
requires sized_range<_View> | ||
{ | ||
return ranges::size(__base_); | ||
} | ||
|
||
_LIBCPP_HIDE_FROM_ABI constexpr auto size() const | ||
requires sized_range<const _View> | ||
{ | ||
return ranges::size(__base_); | ||
} | ||
}; | ||
|
||
template <class _Range> | ||
as_rvalue_view(_Range&&) -> as_rvalue_view<views::all_t<_Range>>; | ||
|
||
template <class _View> | ||
inline constexpr bool enable_borrowed_range<as_rvalue_view<_View>> = enable_borrowed_range<_View>; | ||
|
||
namespace views { | ||
namespace __as_rvalue { | ||
struct __fn : __range_adaptor_closure<__fn> { | ||
template <class _Range> | ||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
operator()(_Range&& __range) noexcept(noexcept(as_rvalue_view(std::forward<_Range>(__range)))) | ||
-> decltype(/*--------------------------*/ as_rvalue_view(std::forward<_Range>(__range))) { | ||
return /*---------------------------------*/ as_rvalue_view(std::forward<_Range>(__range)); | ||
} | ||
|
||
template <class _Range> | ||
requires same_as<range_rvalue_reference_t<_Range>, range_reference_t<_Range>> | ||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto | ||
operator()(_Range&& __range) noexcept(noexcept(views::all(std::forward<_Range>(__range)))) | ||
-> decltype(/*--------------------------*/ views::all(std::forward<_Range>(__range))) { | ||
return /*---------------------------------*/ views::all(std::forward<_Range>(__range)); | ||
} | ||
}; | ||
} // namespace __as_rvalue | ||
|
||
inline namespace __cpo { | ||
inline constexpr auto as_rvalue = __as_rvalue::__fn{}; | ||
} // namespace __cpo | ||
} // namespace views | ||
} // namespace ranges | ||
|
||
_LIBCPP_END_NAMESPACE_STD | ||
|
||
#endif // _LIBCPP_STD_VER >= 23 | ||
|
||
_LIBCPP_POP_MACROS | ||
|
||
#endif // _LIBCPP___RANGES_AS_RVALUE_H |
Oops, something went wrong.