Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Inconsistent usage for Property Map misuse produces different, unhelpful errors

Đang mở
#472 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp
Lĩnh vực
compilers

Hướng nghiên cứu

Bắt đầu với boost/property_map/property_map.hpp quanh dòng 311 và so sánh các ví dụ về Dijkstra và Bellman được liên kết trong issue. Xem lại cách các thuật toán đó xác thực các danh mục property-map và sử dụng các trường hợp trên Compiler Explorer để đánh giá các chẩn đoán. Công việc được xem là hoàn tất khi đã thống nhất một phương pháp chẩn đoán có phạm vi xác định và chứng minh được các lỗi rõ ràng hơn cho những trường hợp sử dụng sai bị ảnh hưởng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

api

Not sure this is a very helpful issue, as I am still catching up on Boost Concepts, but I will drop it for the record and discussion

Problem 1: Algorithms that perform no check at all

When a user passes a property map with the wrong category to an algorithm, the compiler error is deeply nested and unhelpful.

For example, passing a read-only distance property map to dijkstra fails to compile with a long and rather cryptic error, ending with

app/boost/include/boost/property_map/property_map.hpp:311:40: error: lvalue required as left operand of assignment
  311 |     static_cast<const PropertyMap&>(pa)[k] = v;

See on Compiler Explorer

Problem 2: Algorithms that check boost concepts

Some algorithms like Bellman use Boost Concepts to check the property map category, but the output is actually worse than no check.
See on compiler explorer

Proposal

I guess the use of Boost Concepts is justified by pre-C++11 static_assert. Also for documentation purpose. But maybe we should open a conversation on making compilation error messages more clear.

Maybe add static_assert checks for property map categories in algorithms that currently lack them:

static_assert(
    std::is_convertible<
        typename property_traits<DistanceMap>::category,
        read_write_property_map_tag>::value,
    "distance_map must be a ReadWrite property map (supports both get and put)");

This produces a single line error:

error: static_assert failed "distance_map must be a ReadWrite property map 
(supports both get and put)"

See on Compiler Explorer

Ngôn ngữ chính
C++
Star
399
Fork
247
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
40

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của boostorg/graph

Tất cả issue của boostorg/graph

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.