The following code appears in boost graph library manual available here.
I have no problem understanding what the code does. My questions are:
(1)Why is the graph object passed as a constant reference. const Graph& g ?
(2)Why is the edge descriptor not passed similarly, but simply by value?
As I understand, the answer to (1) is that it imposes a constraint to ensure that the function is_self_loop() does not modify the object g and also that no copy is made of g within the function.
On the other hand, a copy is indeed made within the function of the edge_descriptor.
Is there any reason to accord these two different reasonings for the two passed objects? The function does not seem to alter e either, so why not pass it as a const and also to prevent a local copy, why not also pass it as a reference? Does this have to do with the sizes of g and e? That is, copying e is not a costly operation? If yes, how can the user figure out which object is "easy" to copy and which object is expensive to copy?

