Skip to content

[libcxx] removes dedicated namespaces for ranges stuff #76543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_adjacent_find.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __adjacent_find {
struct __fn {
struct __adjacent_find {
template <class _Iter, class _Sent, class _Proj, class _Pred>
_LIBCPP_HIDE_FROM_ABI constexpr static _Iter
__adjacent_find_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
Expand Down Expand Up @@ -67,10 +66,9 @@ struct __fn {
return __adjacent_find_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __adjacent_find

inline namespace __cpo {
inline constexpr auto adjacent_find = __adjacent_find::__fn{};
inline constexpr auto adjacent_find = __adjacent_find{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_all_of.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __all_of {
struct __fn {
struct __all_of {
template <class _Iter, class _Sent, class _Proj, class _Pred>
_LIBCPP_HIDE_FROM_ABI constexpr static bool __all_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
Expand All @@ -58,10 +57,9 @@ struct __fn {
return __all_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __all_of

inline namespace __cpo {
inline constexpr auto all_of = __all_of::__fn{};
inline constexpr auto all_of = __all_of{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_any_of.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __any_of {
struct __fn {
struct __any_of {
template <class _Iter, class _Sent, class _Proj, class _Pred>
_LIBCPP_HIDE_FROM_ABI constexpr static bool __any_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
Expand All @@ -58,10 +57,9 @@ struct __fn {
return __any_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __any_of

inline namespace __cpo {
inline constexpr auto any_of = __any_of::__fn{};
inline constexpr auto any_of = __any_of{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_binary_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __binary_search {
struct __fn {
struct __binary_search {
template <forward_iterator _Iter,
sentinel_for<_Iter> _Sent,
class _Type,
Expand All @@ -57,10 +56,9 @@ struct __fn {
return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret));
}
};
} // namespace __binary_search

inline namespace __cpo {
inline constexpr auto binary_search = __binary_search::__fn{};
inline constexpr auto binary_search = __binary_search{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_clamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __clamp {
struct __fn {
struct __clamp {
template <class _Type,
class _Proj = identity,
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
Expand All @@ -50,10 +49,9 @@ struct __fn {
return __value;
}
};
} // namespace __clamp

inline namespace __cpo {
inline constexpr auto clamp = __clamp::__fn{};
inline constexpr auto clamp = __clamp{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_contains.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __contains {
struct __fn {
struct __contains {
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool static
Expand All @@ -50,10 +49,9 @@ struct __fn {
ranges::end(__range);
}
};
} // namespace __contains

inline namespace __cpo {
inline constexpr auto contains = __contains::__fn{};
inline constexpr auto contains = __contains{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_contains_subrange.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __contains_subrange {
struct __fn {
struct __contains_subrange {
template <forward_iterator _Iter1,
sentinel_for<_Iter1> _Sent1,
forward_iterator _Iter2,
Expand Down Expand Up @@ -81,10 +80,9 @@ struct __fn {
return __ret.empty() == false;
}
};
} // namespace __contains_subrange

inline namespace __cpo {
inline constexpr auto contains_subrange = __contains_subrange::__fn{};
inline constexpr auto contains_subrange = __contains_subrange{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ namespace ranges {
template <class _InIter, class _OutIter>
using copy_result = in_out_result<_InIter, _OutIter>;

namespace __copy {
struct __fn {
struct __copy {
template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
requires indirectly_copyable<_InIter, _OutIter>
_LIBCPP_HIDE_FROM_ABI constexpr copy_result<_InIter, _OutIter>
Expand All @@ -55,10 +54,9 @@ struct __fn {
return {std::move(__ret.first), std::move(__ret.second)};
}
};
} // namespace __copy

inline namespace __cpo {
inline constexpr auto copy = __copy::__fn{};
inline constexpr auto copy = __copy{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_copy_backward.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ namespace ranges {
template <class _Ip, class _Op>
using copy_backward_result = in_out_result<_Ip, _Op>;

namespace __copy_backward {
struct __fn {
struct __copy_backward {
template <bidirectional_iterator _InIter1, sentinel_for<_InIter1> _Sent1, bidirectional_iterator _InIter2>
requires indirectly_copyable<_InIter1, _InIter2>
_LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<_InIter1, _InIter2>
Expand All @@ -53,10 +52,9 @@ struct __fn {
return {std::move(__ret.first), std::move(__ret.second)};
}
};
} // namespace __copy_backward

inline namespace __cpo {
inline constexpr auto copy_backward = __copy_backward::__fn{};
inline constexpr auto copy_backward = __copy_backward{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_copy_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ namespace ranges {
template <class _Ip, class _Op>
using copy_if_result = in_out_result<_Ip, _Op>;

namespace __copy_if {
struct __fn {
struct __copy_if {
template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred>
_LIBCPP_HIDE_FROM_ABI static constexpr copy_if_result<_InIter, _OutIter>
__copy_if_impl(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) {
Expand Down Expand Up @@ -71,10 +70,9 @@ struct __fn {
return __copy_if_impl(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj);
}
};
} // namespace __copy_if

inline namespace __cpo {
inline constexpr auto copy_if = __copy_if::__fn{};
inline constexpr auto copy_if = __copy_if{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_copy_n.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ namespace ranges {
template <class _Ip, class _Op>
using copy_n_result = in_out_result<_Ip, _Op>;

namespace __copy_n {
struct __fn {
struct __copy_n {
template <class _InIter, class _DiffType, class _OutIter>
_LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter>
__go(_InIter __first, _DiffType __n, _OutIter __result) {
Expand All @@ -65,10 +64,9 @@ struct __fn {
return __go(std::move(__first), __n, std::move(__result));
}
};
} // namespace __copy_n

inline namespace __cpo {
inline constexpr auto copy_n = __copy_n::__fn{};
inline constexpr auto copy_n = __copy_n{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __count {
struct __fn {
struct __count {
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
Expand All @@ -50,10 +49,9 @@ struct __fn {
return std::__count<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __proj);
}
};
} // namespace __count

inline namespace __cpo {
inline constexpr auto count = __count::__fn{};
inline constexpr auto count = __count{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_count_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ __count_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
return __counter;
}

namespace __count_if {
struct __fn {
struct __count_if {
template <input_iterator _Iter,
sentinel_for<_Iter> _Sent,
class _Proj = identity,
Expand All @@ -63,10 +62,9 @@ struct __fn {
return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
}
};
} // namespace __count_if

inline namespace __cpo {
inline constexpr auto count_if = __count_if::__fn{};
inline constexpr auto count_if = __count_if{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_ends_with.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __ends_with {
struct __fn {
struct __ends_with {
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
_LIBCPP_HIDE_FROM_ABI static constexpr bool __ends_with_fn_impl_bidirectional(
_Iter1 __first1,
Expand Down Expand Up @@ -185,10 +184,9 @@ struct __fn {
}
}
};
} // namespace __ends_with

inline namespace __cpo {
inline constexpr auto ends_with = __ends_with::__fn{};
inline constexpr auto ends_with = __ends_with{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_equal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __equal {
struct __fn {
struct __equal {
template <input_iterator _Iter1,
sentinel_for<_Iter1> _Sent1,
input_iterator _Iter2,
Expand Down Expand Up @@ -93,10 +92,9 @@ struct __fn {
return false;
}
};
} // namespace __equal

inline namespace __cpo {
inline constexpr auto equal = __equal::__fn{};
inline constexpr auto equal = __equal{};
} // namespace __cpo
} // namespace ranges

Expand Down
8 changes: 2 additions & 6 deletions libcxx/include/__algorithm/ranges_equal_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __equal_range {

struct __fn {
struct __equal_range {
template <forward_iterator _Iter,
sentinel_for<_Iter> _Sent,
class _Tp,
Expand All @@ -64,10 +62,8 @@ struct __fn {
}
};

} // namespace __equal_range

inline namespace __cpo {
inline constexpr auto equal_range = __equal_range::__fn{};
inline constexpr auto equal_range = __equal_range{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_fill.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __fill {
struct __fn {
struct __fill {
template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent>
_LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const {
if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
Expand All @@ -46,10 +45,9 @@ struct __fn {
return (*this)(ranges::begin(__range), ranges::end(__range), __value);
}
};
} // namespace __fill

inline namespace __cpo {
inline constexpr auto fill = __fill::__fn{};
inline constexpr auto fill = __fill{};
} // namespace __cpo
} // namespace ranges

Expand Down
6 changes: 2 additions & 4 deletions libcxx/include/__algorithm/ranges_fill_n.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {
namespace __fill_n {
struct __fn {
struct __fill_n {
template <class _Type, output_iterator<const _Type&> _Iter>
_LIBCPP_HIDE_FROM_ABI constexpr _Iter
operator()(_Iter __first, iter_difference_t<_Iter> __n, const _Type& __value) const {
Expand All @@ -37,10 +36,9 @@ struct __fn {
return __first;
}
};
} // namespace __fill_n

inline namespace __cpo {
inline constexpr auto fill_n = __fill_n::__fn{};
inline constexpr auto fill_n = __fill_n{};
} // namespace __cpo
} // namespace ranges

Expand Down
Loading
Loading