Suppose I have a class hierarchy, like so:
struct Foo {
virtual Output doSomething(const Input& in);
};
class CompositeFoo {
std::vector fooList; // Use your favorite smart pointer standin
for Foo* here
public:
Output doSomething(const Input& in);
};
Now, suppose I have a functor:
class Functor {
Foo* foo;
Input input; // assume Input is copyable
public:
Output operator()() { foo->doSomething(input); }
};
Now, the structure of doSomething() calls leads to a DAG structure with
Functor as the vertices. What I want to do is create a graph with BGL
that shows that structure, before topologically sorting it and doing
other stuff with it. However, it would appear that the vertices of the
graph (which I would assume to be of type
boost::adjacency_list) must be default-constructible, which Functor is clearly not.
Is there a nice workaround to this without changing the vertex type to
Functor* (again, use your favorite smart pointer standin for Functor*
here)?