[Feature request] Consider adding support of reference proxy
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Đọc tài liệu iterator_facade được liên kết trong issue và xem lại phần tiếp nối từ issue 47 để hiểu các quy tắc suy luận iterator-category. Xác định việc hỗ trợ các iterator RandomAccess có tham chiếu proxy nên có nghĩa là gì, bao gồm cả việc có cần một proxy tag hay không, và xác minh rằng API kết quả không còn yêu cầu ghi đè iterator_category theo cách thủ công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Continuing https://github.com/boostorg/iterator/issues/47.
Currently, iterator_facade does not allow to have RandomAcess iterator with reference proxy (aka std::vector<bool>::iterator::reference) .
It looks like that the only thing that prevent this - is iterator-category deduction/override rules https://www.boost.org/doc/libs/1_68_0/libs/iterator/doc/iterator_facade.html :
iterator-category(C,R,V) :=
if (C is convertible to std::input_iterator_tag
|| C is convertible to std::output_iterator_tag
)
return C
else if (C is not convertible to incrementable_traversal_tag)
the program is ill-formed
else return a type X satisfying the following two constraints:
1. X is convertible to X1, and not to any more-derived
type, where X1 is defined by:
if (R is a reference type
&& C is convertible to forward_traversal_tag)
{
if (C is convertible to random_access_traversal_tag)
X1 = random_access_iterator_tag
else if (C is convertible to bidirectional_traversal_tag)
X1 = bidirectional_iterator_tag
else
X1 = forward_iterator_tag
}
else
{
if (C is convertible to single_pass_traversal_tag
&& R is convertible to V)
X1 = input_iterator_tag
else
X1 = C
}
2. category-to-traversal(X) is convertible to the most
derived traversal tag type to which X is also
convertible, and not to any more-derived traversal tag
type.
The simplest solution for now, seems to override manually iterator_category in Derived class.
Maybe add some proxy tag? Like:
class node_iterator
: public boost::iterator_facade
<
node_iterator
, std::pair<int, int>
, boost::bidirectional_traversal_tag
, boost::iterator_facade::proxy_reference<std::pair<int, int>>
>
And do not downgrade iterator-category, if proxy_reference occurs.
- Ngôn ngữ chính
- C++
- Star
- 23
- Fork
- 70
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của boostorg/iterator
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
Tất cả issue của boostorg/iterator
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AXERA-TECH/ax-llm#77 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
games-on-whales/wolf#509 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
bug-unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NVIDIA/cuda-samples#453 ·