[BGL] Usage of stateful allocator

Is a static instance of a stateful allocator the only way to make the BGL graph interface accept it with boost::container_gen, or is the use of a stateful allocator with the BGL possible? The reason this is necessary is that I'd like to wrap an array class (which isn't STL compatible) provided by a third party for use with the BGL so that I can navigate the array of vertices and edges as modeled by the graph it contains. This array class however is useless unless it receives a reference to an instance of the stateful allocator upon its' construction. Currently I have to hold a BGL graph in memory which contains vertex and edge array indices reflecting matching positions in instances of the third party array class (one for the vertices, one for all the edges). (Unrelatedly but possibly useful to know) Once this graph is complete, I need access to the arrays themselves to pass them on to other objects that are part of the third party library. Thanks, Geoff

On Thu, 3 Jun 2010, Geoff Hilton wrote:
Is a static instance of a stateful allocator the only way to make the BGL graph interface accept it with boost::container_gen, or is the use of a stateful allocator with the BGL possible?
The reason this is necessary is that I'd like to wrap an array class (which isn't STL compatible) provided by a third party for use with the BGL so that I can navigate the array of vertices and edges as modeled by the graph it contains. This array class however is useless unless it receives a reference to an instance of the stateful allocator upon its' construction. Currently I have to hold a BGL graph in memory which contains vertex and edge array indices reflecting matching positions in instances of the third party array class (one for the vertices, one for all the edges). (Unrelatedly but possibly useful to know) Once this graph is complete, I need access to the arrays themselves to pass them on to other objects that are part of the third party library.
I do not believe BGL can use stateful allocators; this has been requested for a long time but was not considered important enough to implement. Would you be better off creating your own graph class that stores the arrays in the format you have and models the appropriate graph concepts? The internal data storage of BGL's own graph types is probably not what you want for the third-party library anyway. -- Jeremiah Willcock
participants (2)
-
Geoff Hilton
-
Jeremiah Willcock