|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-25 18:07:18
Hi Ken,
On Sun, 25 Mar 2001, Ken Appleby wrote:
ken> namespace lg {
ken> template <class Allocator>
ken> struct vector_with_allocatorS {};
ken> }
ken>
ken> // ==> what should X be?
ken> typedef boost::adjacency_list<vector_with_allocatorS<X>, vector_with_allocatorS<X>, boost::bidirectionalS, VertexProperty,
ken> EdgeProperty> Graph;
ken>
ken>
ken> The difficulty seems to be that X requires the definition of
ken> Graph that it is itself a part of.
So X should be your specialized allocator type, and the template argument
T to your allocator doesn't matter, because it gets rebound to the correct
ValueType inside your specialization of container_gen. Use anything for
T, like char.
ken> namespace boost {
ken> template <class Alloc, class ValueType>
ken> struct container_gen<lg::vector_with_allocatorS<Alloc>, ValueType>{
ken> typedef typename Alloc::template rebind<ValueType>::other
ken> Allocator;
ken> typedef std::vector<ValueType, Allocator> type;
ken> };
ken> }
Cheers,
Jeremy
P.S. Mind if I post the reply to boost as well?
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate email: jsiek_at_[hidden]
Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk