Hello, I adapt my own graph like data structures. They form a derivation hierarchy, and they are all in the same graph category. In order to avoid that I have to repeat the specializations of the graph traits, I put all the types needed in the base class, so the default graph traits, which just takes the types out of the class it is applied to, will get them from the base class or via inherited types from the base class. What can I do in order to repeat the definition of the functions source(..), target(..) etc. I could tell my users to downcast but that's not nice. I also could have #defines for all my classes so that I write the code only once, but all these solutions are not appealing. any suggestion? andreas
Hello Andreas, Andreas Fabri wrote:
I adapt my own graph like data structures. They form a derivation hierarchy, and they are all in the same graph category.
In order to avoid that I have to repeat the specializations of the graph traits, I put all the types needed in the base class, so the default graph traits, which just takes the types out of the class it is applied to, will get them from the base class or via inherited types from the base class.
Okay.
What can I do in order to repeat the definition of the functions source(..), target(..) etc.
I could tell my users to downcast but that's not nice. I also could have #defines for all my classes so that I write the code only once, but all these solutions are not appealing.
You should be able to write source, target, etc. in terms of the base class. Several of the BGL's own graph data types do this, too. - Doug
participants (2)
-
Andreas Fabri
-
Douglas Gregor