Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/graph/example/container_gen.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.3 KB
Line 
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
11#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ALLOCATOR)
12
13template <class Allocator>
14struct list_with_allocatorS { };
15
16namespace boost {
17  template <class Alloc, class ValueType>
18  struct container_gen<list_with_allocatorS<Alloc>, ValueType> {
19    typedef typename Alloc::template rebind<ValueType>::other Allocator;
20    typedef std::list<ValueType, Allocator> type;
21  };
22  template <class Alloc>
23  struct parallel_edge_traits< list_with_allocatorS<Alloc> > { 
24    typedef allow_parallel_edge_tag type;
25  };
26
27}
28
29// now you can define a graph using std::list and a specific allocator 
30typedef boost::adjacency_list< list_with_allocatorS< std::allocator<int> >,
31  boost::vecS, boost::directedS> MyGraph;
32
33int main(int, char*[])
34{
35  MyGraph g(5);
36 
37  return 0;
38}
39
40#else
41
42int main(int, char*[])
43{
44  return 0;
45}
46
47#endif
Note: See TracBrowser for help on using the repository browser.