Inconsistent usage for Property Map misuse produces different, unhelpful errors
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start with boost/property_map/property_map.hpp around line 311 and compare the Dijkstra and Bellman examples linked in the issue. Review how those algorithms validate property-map categories and use the Compiler Explorer cases to assess the diagnostics. Done means agreeing on a scoped diagnostic approach and demonstrating clearer errors for the affected misuse cases.
Written by the indexing model from the issue text.
Description
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;
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)"
- Dominant language
- C++
- Stars
- 396
- Forks
- 244
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 29
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/graph
-
beginner friendly
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
boostorg/graph#593 · 34 comments ·
Maintainers usually reply within 1 day
-
algorithm beginner friendly priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
boostorg/graph#231 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
boostorg/graph#599 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
State of warnings in CI `develop`May be free again @Becheler claimed this 120 days ago, and no pull request is open. Openpriority: high warning
boostorg/graph#496 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
plengauer/DXGIOutputDuplication#81 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sudoevolve/EUI-NEO#80 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Ryan-Millard/Img2Num#681 · 2 comments ·
Maintainers usually reply within 2 days
-
upstream update
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conan-io/conan-center-index#31098 ·
Maintainers usually reply within 2 days