~ubuntu-branches/ubuntu/utopic/libthrust/utopic

« back to all changes in this revision

Viewing changes to detail/remove.inl

  • Committer: Package Import Robot
  • Author(s): Andreas Beckmann
  • Date: 2013-07-10 12:57:33 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130710125733-my19jic71sqsabaj
Tags: 1.7.0-1
* New upstream release.  (Closes: #715362)
* Update watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <thrust/iterator/iterator_traits.h>
25
25
#include <thrust/system/detail/generic/select_system.h>
26
26
#include <thrust/system/detail/generic/remove.h>
27
 
#include <thrust/detail/adl_helper.h>
 
27
#include <thrust/system/detail/adl/remove.h>
28
28
 
29
29
namespace thrust
30
30
{
31
31
 
 
32
 
 
33
template<typename DerivedPolicy,
 
34
         typename ForwardIterator,
 
35
         typename T>
 
36
  ForwardIterator remove(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
37
                         ForwardIterator first,
 
38
                         ForwardIterator last,
 
39
                         const T &value)
 
40
{
 
41
  using thrust::system::detail::generic::remove;
 
42
  return remove(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, value);
 
43
} // end remove()
 
44
 
 
45
 
 
46
template<typename DerivedPolicy,
 
47
         typename InputIterator,
 
48
         typename OutputIterator,
 
49
         typename T>
 
50
  OutputIterator remove_copy(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
51
                             InputIterator first,
 
52
                             InputIterator last,
 
53
                             OutputIterator result,
 
54
                             const T &value)
 
55
{
 
56
  using thrust::system::detail::generic::remove_copy;
 
57
  return remove_copy(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, result, value);
 
58
} // end remove_copy()
 
59
 
 
60
 
 
61
template<typename DerivedPolicy,
 
62
         typename ForwardIterator,
 
63
         typename Predicate>
 
64
  ForwardIterator remove_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
65
                            ForwardIterator first,
 
66
                            ForwardIterator last,
 
67
                            Predicate pred)
 
68
{
 
69
  using thrust::system::detail::generic::remove_if;
 
70
  return remove_if(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, pred);
 
71
} // end remove_if()
 
72
 
 
73
 
 
74
template<typename DerivedPolicy,
 
75
         typename InputIterator,
 
76
         typename OutputIterator,
 
77
         typename Predicate>
 
78
  OutputIterator remove_copy_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
79
                                InputIterator first,
 
80
                                InputIterator last,
 
81
                                OutputIterator result,
 
82
                                Predicate pred)
 
83
{
 
84
  using thrust::system::detail::generic::remove_copy_if;
 
85
  return remove_copy_if(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, result, pred);
 
86
} // end remove_copy_if()
 
87
 
 
88
 
 
89
template<typename DerivedPolicy,
 
90
         typename ForwardIterator,
 
91
         typename InputIterator,
 
92
         typename Predicate>
 
93
  ForwardIterator remove_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
94
                            ForwardIterator first,
 
95
                            ForwardIterator last,
 
96
                            InputIterator stencil,
 
97
                            Predicate pred)
 
98
{
 
99
  using thrust::system::detail::generic::remove_if;
 
100
  return remove_if(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, stencil, pred);
 
101
} // end remove_if()
 
102
 
 
103
 
 
104
template<typename DerivedPolicy,
 
105
         typename InputIterator1,
 
106
         typename InputIterator2,
 
107
         typename OutputIterator,
 
108
         typename Predicate>
 
109
  OutputIterator remove_copy_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
110
                                InputIterator1 first,
 
111
                                InputIterator1 last,
 
112
                                InputIterator2 stencil,
 
113
                                OutputIterator result,
 
114
                                Predicate pred)
 
115
{
 
116
  using thrust::system::detail::generic::remove_copy_if;
 
117
  return remove_copy_if(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, stencil, result, pred);
 
118
} // end remove_copy_if()
 
119
 
 
120
 
32
121
template<typename ForwardIterator,
33
122
         typename T>
34
123
  ForwardIterator remove(ForwardIterator first,
36
125
                         const T &value)
37
126
{
38
127
  using thrust::system::detail::generic::select_system;
39
 
  using thrust::system::detail::generic::remove;
40
 
 
41
 
  typedef typename thrust::iterator_system<ForwardIterator>::type system;
42
 
 
43
 
  return remove(select_system(system()), first, last, value);
 
128
 
 
129
  typedef typename thrust::iterator_system<ForwardIterator>::type System;
 
130
 
 
131
  System system;
 
132
 
 
133
  return thrust::remove(select_system(system), first, last, value);
44
134
} // end remove()
45
135
 
 
136
 
46
137
template<typename InputIterator,
47
138
         typename OutputIterator,
48
139
         typename T>
52
143
                             const T &value)
53
144
{
54
145
  using thrust::system::detail::generic::select_system;
55
 
  using thrust::system::detail::generic::remove_copy;
56
 
 
57
 
  typedef typename thrust::iterator_system<InputIterator>::type  system1;
58
 
  typedef typename thrust::iterator_system<OutputIterator>::type system2;
59
 
 
60
 
  return remove_copy(select_system(system1(),system2()), first, last, result, value);
 
146
 
 
147
  typedef typename thrust::iterator_system<InputIterator>::type  System1;
 
148
  typedef typename thrust::iterator_system<OutputIterator>::type System2;
 
149
 
 
150
  System1 system1;
 
151
  System2 system2;
 
152
 
 
153
  return thrust::remove_copy(select_system(system1,system2), first, last, result, value);
61
154
} // end remove_copy()
62
155
 
 
156
 
63
157
template<typename ForwardIterator,
64
158
         typename Predicate>
65
159
  ForwardIterator remove_if(ForwardIterator first,
67
161
                            Predicate pred)
68
162
{
69
163
  using thrust::system::detail::generic::select_system;
70
 
  using thrust::system::detail::generic::remove_if;
71
 
 
72
 
  typedef typename thrust::iterator_system<ForwardIterator>::type system;
73
 
 
74
 
  return remove_if(select_system(system()), first, last, pred);
 
164
 
 
165
  typedef typename thrust::iterator_system<ForwardIterator>::type System;
 
166
 
 
167
  System system;
 
168
 
 
169
  return thrust::remove_if(select_system(system), first, last, pred);
75
170
} // end remove_if()
76
171
 
 
172
 
77
173
template<typename ForwardIterator,
78
174
         typename InputIterator,
79
175
         typename Predicate>
83
179
                            Predicate pred)
84
180
{
85
181
  using thrust::system::detail::generic::select_system;
86
 
  using thrust::system::detail::generic::remove_if;
87
 
 
88
 
  typedef typename thrust::iterator_system<ForwardIterator>::type system1;
89
 
  typedef typename thrust::iterator_system<InputIterator>::type   system2;
90
 
 
91
 
  return remove_if(select_system(system1(),system2()), first, last, stencil, pred);
 
182
 
 
183
  typedef typename thrust::iterator_system<ForwardIterator>::type System1;
 
184
  typedef typename thrust::iterator_system<InputIterator>::type   System2;
 
185
 
 
186
  System1 system1;
 
187
  System2 system2;
 
188
 
 
189
  return thrust::remove_if(select_system(system1,system2), first, last, stencil, pred);
92
190
} // end remove_if()
93
191
 
 
192
 
94
193
template<typename InputIterator,
95
194
         typename OutputIterator,
96
195
         typename Predicate>
100
199
                                Predicate pred)
101
200
{
102
201
  using thrust::system::detail::generic::select_system;
103
 
  using thrust::system::detail::generic::remove_copy_if;
104
 
 
105
 
  typedef typename thrust::iterator_system<InputIterator>::type  system1;
106
 
  typedef typename thrust::iterator_system<OutputIterator>::type system2;
107
 
 
108
 
  return remove_copy_if(select_system(system1(),system2()), first, last, result, pred);
 
202
 
 
203
  typedef typename thrust::iterator_system<InputIterator>::type  System1;
 
204
  typedef typename thrust::iterator_system<OutputIterator>::type System2;
 
205
 
 
206
  System1 system1;
 
207
  System2 system2;
 
208
 
 
209
  return thrust::remove_copy_if(select_system(system1,system2), first, last, result, pred);
109
210
} // end remove_copy_if()
110
211
 
 
212
 
111
213
template<typename InputIterator1,
112
214
         typename InputIterator2,
113
215
         typename OutputIterator,
119
221
                                Predicate pred)
120
222
{
121
223
  using thrust::system::detail::generic::select_system;
122
 
  using thrust::system::detail::generic::remove_copy_if;
123
 
 
124
 
  typedef typename thrust::iterator_system<InputIterator1>::type system1;
125
 
  typedef typename thrust::iterator_system<InputIterator2>::type system2;
126
 
  typedef typename thrust::iterator_system<OutputIterator>::type system3;
127
 
 
128
 
  return remove_copy_if(select_system(system1(),system2(),system3()), first, last, stencil, result, pred);
 
224
 
 
225
  typedef typename thrust::iterator_system<InputIterator1>::type System1;
 
226
  typedef typename thrust::iterator_system<InputIterator2>::type System2;
 
227
  typedef typename thrust::iterator_system<OutputIterator>::type System3;
 
228
 
 
229
  System1 system1;
 
230
  System2 system2;
 
231
  System3 system3;
 
232
 
 
233
  return thrust::remove_copy_if(select_system(system1,system2,system3), first, last, stencil, result, pred);
129
234
} // end remove_copy_if()
130
235
 
 
236
 
131
237
} // end namespace thrust
132
238