Crazy Eddie's GUI System  ${CEGUI_VERSION}
list.hpp
1 // This file has been generated by Py++.
2 
3 // Copyright (c) 2003 Raoul M. Gough
4 //
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
7 // at http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // Header file list.hpp
10 //
11 // Indexing algorithms support for std::list instances
12 //
13 // History
14 // =======
15 // 2003/10/28 rmg File creation from algo_selector.hpp
16 // 2008/12/08 Roman Change indexing suite layout
17 //
18 // $Id: list.hpp,v 1.1.2.7 2004/02/08 18:57:42 raoulgough Exp $
19 //
20 
21 #ifndef BOOST_PYTHON_INDEXING_LIST_HPP
22 #define BOOST_PYTHON_INDEXING_LIST_HPP
23 
24 #include <indexing_suite/container_traits.hpp>
25 #include <indexing_suite/container_suite.hpp>
26 #include <indexing_suite/algorithms.hpp>
27 #include <list>
28 
29 #if BOOST_WORKAROUND (BOOST_MSVC, == 1200)
30 # include <boost/static_assert.hpp>
31 # include <boost/type_traits.hpp>
32 #endif
33 
34 namespace boost { namespace python { namespace indexing {
36  // ContainerTraits implementation for std::list instances
38 
39  template<typename Container, typename ValueTraits = detail::no_override>
41  : public base_container_traits<Container, ValueTraits>
42  {
44 
45  public:
46  typedef typename base_class::value_traits_type value_traits_type;
47 
48  BOOST_STATIC_CONSTANT(
49  method_set_type,
50  supported_methods = (
51  method_len
52  | method_iter
53 
55  value_traits_type::equality_comparable,
56  method_contains
57  | method_count
58  >::value
59 
61  base_class::is_mutable,
62  method_reverse
63  | method_append
64  >::value
65 
67  type_traits::ice_and<
68  base_class::is_mutable,
69  value_traits_type::less_than_comparable
70  >::value,
71  method_sort
72  >::value
73 
74  ));
75  };
76 
78  // Algorithms implementation for std::list instances
80 
81  template<typename ContainerTraits, typename Ovr = detail::no_override>
83  : public default_algorithms
84  <ContainerTraits,
85  typename detail::maybe_override
86  <list_algorithms<ContainerTraits, Ovr>, Ovr>
87  ::type>
88  {
90  typedef typename detail::maybe_override<self_type, Ovr>::type most_derived;
92 
93  public:
94  typedef typename Parent::container container;
95 
96  // Use member functions for the following (hiding base class versions)
97  static void reverse (container &);
98  static void sort (container &);
99  // static void sort (container &, PyObject *);
100  };
101 
102 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
103  namespace detail {
105  // algorithms support for std::list instances
107 
108  template <class T, class Allocator>
109  class algorithms_selector<std::list<T, Allocator> >
110  {
111  typedef std::list<T, Allocator> Container;
112 
115 
116  public:
119  };
120  }
121 #endif
122 
123  template<
124  class Container,
125  method_set_type MethodMask = all_methods,
126  class Traits = list_traits<Container>
127  >
128  struct list_suite
129  : container_suite<Container, MethodMask, list_algorithms<Traits> >
130  {
131  };
132 
134  // Reverse the contents of a list (using member function)
136 
137  template<typename ContainerTraits, typename Ovr>
139  {
140  c.reverse();
141  }
142 
144  // Sort the contents of a list (using member function)
146 
147  template<typename ContainerTraits, typename Ovr>
149  {
150  typedef typename self_type::container_traits::value_traits_type
151  vtraits;
152 
153  typedef typename vtraits::less comparison;
154 #if BOOST_WORKAROUND (BOOST_MSVC, == 1200)
155  // MSVC6 doesn't have a templated sort member in list, so we just
156  // use the parameterless version. This gives the correct behaviour
157  // provided that value_traits_type::less is exactly
158  // std::less<value_type>. It would be possible to support
159  // std::greater<T> (the only other overload of list::sort in
160  // MSVC6) with some additional work.
161  BOOST_STATIC_ASSERT(
162  (::boost::is_same<comparison, std::less<value_type> >::value));
163  c.sort ();
164 #else
165  c.sort (comparison());
166 #endif
167  }
168 } } }
169 
170 #endif // BOOST_PYTHON_INDEXING_LIST_HPP
171 
172 
173 
Definition: algorithms.hpp:42
Definition: python_CEGUI.h:9
Definition: container_traits.hpp:59
Definition: proxy_iterator.hpp:155
Definition: container_suite.hpp:42
Definition: list.hpp:128