Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
changkhothuychung committed Nov 19, 2024
1 parent 898fa3a commit c0401b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
31 changes: 17 additions & 14 deletions libcxx/include/__ranges/concat_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
#include <__functional/invoke.h>
#include <__functional/reference_wrapper.h>
#include <__iterator/concepts.h>
#include <__iterator/distance.h>
#include <__iterator/default_sentinel.h>
#include <__iterator/iter_move.h>
#include <__iterator/iter_swap.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/next.h>
#include <__memory/addressof.h>
#include <__ranges/access.h>
#include <__ranges/all.h>
Expand All @@ -41,6 +43,7 @@
#include <__utility/forward.h>
#include <__utility/in_place.h>
#include <__utility/move.h>
#include <__variant/monostate.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand All @@ -65,7 +68,7 @@ struct extract_last<T>
};

template<class _T, class... _Ts>
struct derived_from_pack:
struct derived_from_pack
{
constexpr static bool value = derived_from_pack<_T, typename extract_last<_Ts...>::type>::value && derived_from_pack<_Ts...>::value;
};
Expand Down Expand Up @@ -127,7 +130,7 @@ concept concatable = requires { // exposition only

template <bool Const, class... Rs>
concept concat_is_random_access =
(random_access_range<__maybe_const<_Const, _Rs>> && ...)
(random_access_range<__maybe_const<Const, Rs>> && ...)
&&
(sized_range<__maybe_const<Const, Rs>> && ...);

Expand Down Expand Up @@ -235,20 +238,19 @@ template <input_range... Views>
public:
//using iterator_category = see below; // not always present.

using derive_pack_random_iterator = derived_from_pack<iterator_traits<typename iterator_t<__maybe_const<Const, Views>>>::iterator_category..., random_access_iterator_tag>::value;
using derive_pack_bidirectional_iterator = derived_from_pack<iterator_traits<typename iterator_t<__maybe_const<Const, Views>>>::iterator_category..., bidirectional_iterator_tag>::value;
using derive_pack_forward_iterator = derived_from_pack<iterator_traits<typename iterator_t<__maybe_const<Const, Views>>>::iterator_category..., forward_iterator_tag>::value;
constexpr auto derive_pack_random_iterator = derived_from_pack<typename iterator_traits<iterator_t<__maybe_const<Const, Views>>>::iterator_category..., random_access_iterator_tag>::value;
constexpr auto derive_pack_bidirectional_iterator = derived_from_pack<typename iterator_traits<iterator_t<__maybe_const<Const, Views>>>::iterator_category..., bidirectional_iterator_tag>::value;
constexpr auto derive_pack_forward_iterator = derived_from_pack<typename iterator_traits< iterator_t<__maybe_const<Const, Views>>>::iterator_category..., forward_iterator_tag>::value;
using iterator_concept = _If<!is_reference_v<concat_reference_t<__maybe_const<Const, Views>...>>,
input_iterator_tag,
_If<derive_pack_random_iterator,
random_access_iterator_tag,
_If<derive_pack_bidirectional_iterator,
bidirectional_iterator_tag,
_If
<derive_pack_forward_iterator,
forward_iterator_tag,
input_iterator_tag
>
_If<derive_pack_forward_iterator,
forward_iterator_tag,
input_iterator_tag
>
>
>
>;
Expand Down Expand Up @@ -285,7 +287,7 @@ template <input_range... Views>
it_.template emplace<N - 1>(ranges::end(get<N - 1>(parent_->views_)));
} else {
it_.template emplace<N - 1>(
ranges::next(ranges::begin(get<N - 1>(parent_->views_)),
ranges::__next(ranges::begin(get<N - 1>(parent_->views_)),
ranges::size(get<N - 1>(parent_->views_))));
}
prev<N - 1>();
Expand All @@ -303,7 +305,7 @@ template <input_range... Views>
get<N>(it_) += static_cast<underlying_diff_type>(steps);
}
else {
auto n_size = ranges::distance(get<N>(parent_->views_));
auto n_size = ranges::__distance(get<N>(parent_->views_));
if (offset + steps < n_size) {
get<N>(it_) += static_cast<underlying_diff_type>(steps);
} else {
Expand Down Expand Up @@ -357,15 +359,16 @@ template <input_range... Views>
return *this;
}

/*
constexpr void operator++(int)
{
++*this;
}

*/


constexpr iterator operator++(int)
requires all_forward<Const, Views...>
requires (forward_range<__maybe_const<Const, Views>> && ...);
{
auto tmp = *this;
++*this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <cassert>
#include "test_iterators.h"
#include "types.h"

struct Range : std::ranges::view_base {
using Iterator = forward_iterator<int*>;
Expand Down

0 comments on commit c0401b1

Please sign in to comment.