]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | //======================================================================= |
2 | // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. | |
3 | // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek | |
4 | // | |
5 | // Distributed under the Boost Software License, Version 1.0. (See | |
6 | // accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | //======================================================================= | |
9 | #include <boost/graph/adjacency_list.hpp> | |
10 | ||
f67539c2 TL |
11 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
12 | && !defined(BOOST_NO_STD_ALLOCATOR) | |
13 | ||
14 | template < class Allocator > struct list_with_allocatorS | |
15 | { | |
16 | }; | |
17 | ||
18 | namespace boost | |
19 | { | |
20 | template < class Alloc, class ValueType > | |
21 | struct container_gen< list_with_allocatorS< Alloc >, ValueType > | |
22 | { | |
23 | typedef typename Alloc::template rebind< ValueType >::other Allocator; | |
24 | typedef std::list< ValueType, Allocator > type; | |
25 | }; | |
26 | template < class Alloc > | |
27 | struct parallel_edge_traits< list_with_allocatorS< Alloc > > | |
28 | { | |
7c673cae | 29 | typedef allow_parallel_edge_tag type; |
f67539c2 | 30 | }; |
7c673cae FG |
31 | |
32 | } | |
33 | ||
f67539c2 TL |
34 | // now you can define a graph using std::list and a specific allocator |
35 | typedef boost::adjacency_list< list_with_allocatorS< std::allocator< int > >, | |
36 | boost::vecS, boost::directedS > | |
37 | MyGraph; | |
7c673cae FG |
38 | |
39 | int main(int, char*[]) | |
40 | { | |
f67539c2 TL |
41 | MyGraph g(5); |
42 | ||
43 | return 0; | |
7c673cae FG |
44 | } |
45 | ||
46 | #else | |
47 | ||
f67539c2 | 48 | int main(int, char*[]) { return 0; } |
7c673cae FG |
49 | |
50 | #endif |