Boost logo

Boost :

From: hermann_at_[hidden]
Date: 2024-10-15 08:04:03


First I looked in graph/test.
Most times int is used there, only once std::size_t:

property< edge_index_t, int >

Next I looked into graph/example, same picture there.

Ok, I read that example and test might contain stuff that
would not go into BGL code.
So I looked into graph/include/boost/graph:

pi_at_raspberrypi5:~/graph/include/boost/graph $ grep edge_index_t *.hpp |
grep size_t
directed_graph.hpp: typedef std::size_t edge_index_type;
undirected_graph.hpp: typedef std::size_t edge_index_type;
pi_at_raspberrypi5:~/graph/include/boost/graph $ grep edge_index_t *.hpp |
grep unsigned
directed_graph.hpp: typedef property< edge_index_t, unsigned,
edge_property_type >
undirected_graph.hpp: typedef property< edge_index_t, unsigned,
edge_property_type >
pi_at_raspberrypi5:~/graph/include/boost/graph $ grep edge_index_t *.hpp |
grep int
graphviz.hpp: property<edge_index_t, int> >
pi_at_raspberrypi5:~/graph/include/boost/graph $

Only graphviz.hpp uses int.
But directed and undirected graph use std::size_t as well as unsigned.

There are systems when unsigned is smaller than std::size_t:

https://en.cppreference.com/w/cpp/types/size_t

1)
Shouldn't at least directed_graph.hpp and undirected_graph.hpp
make consistent use of std::size_t then?

2)
Shouldn't examples and tests be corrected, as their overly use
of int for edge and vertex index types is misleading?

Regards,

Hermann.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk