boostorg / boostorg/graph

Vertex property `vertex_index_t` silently discarded when `vecS` selector used vertex list

Offen
#420 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
data structure priority: low
Vorherrschende Sprache
C++
Sterne
392
Forks
239
Ø Merge
1 T. 11 Min.
Gemergte PRs (30 T.)
20

Beschreibung

As in the title.

Consider the following code

```cpp
#include
#include
#include
#include

typedef int v_index;
typedef long e_index;

typedef boost::adjacency_list<
boost::vecS, // OutEdgeList
boost::vecS, // VertexList
boost::undirectedS, // DirectedS
boost::property, // Vertex property.
boost::no_property, // Edge property (can be enhanced if needed).
boost::no_property, // Graph property.
boost::vecS // EdgeList
> Graph;

typedef boost::property_map::type vertex_to_int_map;

static_assert(std::is_same_v,
"The vertex property map's value type must be v_index");
```

The static assertion fails. Changing `VertexList` to e.g. `boost::listS` makes it pass.

This causes a little problem in generic code which assumes the type returned by the `vertex_to_int_map` property map is equal to `v_index`. For example https://github.com/sagemath/sage/pull/39526 .

Not sure what's the best course of action here. I think the easiest one would be to make the property map just cast the result to the correct type (assume it can be casted of course, but what if the user specifies something weird like `std::string`?)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.