J
jpr
hello ...
I'm translating a compressed graph class (for large graphs) from Java
to C++. Currently I'm writing a function that should return an iterator
over the successors of a given node. These successors are represented
by int's.
Depending on the way the graph is compressed, I might have to extract
the successors from the bitstream holding the graph in several ways.
Because of this, the Java version had four different iterator classes,
all extending a common base class; it would construct and return the
appropriate one.
I'd like to avoid having to declare my iterator members virtual because
of the overhead of a virtual function call (and the missed chance to
inline). However, I want to be able to return a single type to hide any
detail of how I come up with these types from the client.
Is there a trick to do this sort of thing, or am I chasing a hopeless
dream?
thanks!
-jacob
I'm translating a compressed graph class (for large graphs) from Java
to C++. Currently I'm writing a function that should return an iterator
over the successors of a given node. These successors are represented
by int's.
Depending on the way the graph is compressed, I might have to extract
the successors from the bitstream holding the graph in several ways.
Because of this, the Java version had four different iterator classes,
all extending a common base class; it would construct and return the
appropriate one.
I'd like to avoid having to declare my iterator members virtual because
of the overhead of a virtual function call (and the missed chance to
inline). However, I want to be able to return a single type to hide any
detail of how I come up with these types from the client.
Is there a trick to do this sort of thing, or am I chasing a hopeless
dream?
thanks!
-jacob