32 #ifndef _GLIBCXX_PARALLEL_BASE_H
33 #define _GLIBCXX_PARALLEL_BASE_H 1
50 namespace __parallel { }
57 namespace __gnu_parallel
60 using namespace std::__parallel;
67 namespace __gnu_sequential
70 #ifdef _GLIBCXX_PARALLEL
71 using namespace std::__norm;
78 namespace __gnu_parallel
87 int __i = omp_get_max_threads();
88 return __i > 1 ? __i : 1;
103 template<
typename Size>
108 for (k = 0; n > 1; n >>= 1)
145 min(
const T& a,
const T& b)
146 {
return (a < b) ? a : b; }
151 max(
const T& a,
const T& b)
152 {
return (a > b) ? a : b; }
158 template<
typename Comparator,
typename T1,
typename T2>
167 bool operator()(
const T1& a,
const T2& b)
169 return !comp(a, b) && !comp(b, a);
176 template<
typename _Predicate,
typename argument_type>
189 {
return !_M_pred(__x); }
194 template<
typename _Operation,
typename first_argument_type,
195 typename second_argument_type,
typename result_type>
201 first_argument_type value;
205 const first_argument_type& __y)
206 : op(__x), value(__y) { }
209 operator()(
const second_argument_type& __x)
210 {
return op(value, __x); }
215 operator()(second_argument_type& __x)
const
216 {
return op(value, __x); }
223 template<
typename _Operation,
typename first_argument_type,
224 typename second_argument_type,
typename result_type>
230 second_argument_type value;
234 const second_argument_type& __y)
235 : op(__x), value(__y) { }
238 operator()(
const first_argument_type& __x)
const
239 {
return op(__x, value); }
244 operator()(first_argument_type& __x)
245 {
return op(__x, value); }
249 template<
typename T1,
typename T2>
252 bool operator()(
const T1& t1,
const T2& t2)
const
257 template<
typename T1,
typename T2>
261 operator()(
const T1& t1,
const T2& t2)
const
265 operator()(
const T2& t2,
const T1& t1)
const
270 template<
typename _Tp>
274 operator()(
const _Tp& __x,
const _Tp& __y)
const
275 {
return __x < __y; }
280 template<
typename _Tp1,
typename _Tp2>
283 typedef __typeof__(*static_cast<_Tp1*>(NULL)
284 + *static_cast<_Tp2*>(NULL)) result;
287 operator()(
const _Tp1& __x,
const _Tp2& __y)
const
288 {
return __x + __y; }
292 template<
typename _Tp>
295 typedef __typeof__(*static_cast<_Tp*>(NULL)
296 + *static_cast<_Tp*>(NULL)) result;
299 operator()(const _Tp& __x, const _Tp& __y)
const
300 {
return __x + __y; }
305 template<
typename _Tp1,
typename _Tp2>
308 typedef __typeof__(*static_cast<_Tp1*>(NULL)
309 * *static_cast<_Tp2*>(NULL)) result;
312 operator()(
const _Tp1& __x,
const _Tp2& __y)
const
313 {
return __x * __y; }
317 template<
typename _Tp>
320 typedef __typeof__(*static_cast<_Tp*>(NULL)
321 * *static_cast<_Tp*>(NULL)) result;
324 operator()(const _Tp& __x, const _Tp& __y)
const
325 {
return __x * __y; }
329 template<
typename T,
typename _DifferenceTp>
330 class pseudo_sequence;
337 template<
typename T,
typename _DifferenceTp>
341 typedef _DifferenceTp difference_type;
351 : val(val), pos(pos) { }
364 {
return type(pos++); }
371 operator[](difference_type)
const
375 operator==(
const type& i2)
376 {
return pos == i2.pos; }
379 operator!=(
const type& i2)
380 {
return pos != i2.pos; }
383 operator-(
const type& i2)
384 {
return pos - i2.pos; }
393 template<
typename T,
typename _DifferenceTp>
399 typedef _DifferenceTp difference_type;
409 : val(val), count(count) { }
423 difference_type count;
427 template<
typename _ValueTp>
431 operator()(
const _ValueTp& v)
const { }
441 template<
typename RandomAccessIterator,
typename Comparator>
444 RandomAccessIterator c, Comparator& comp)
467 #define _GLIBCXX_PARALLEL_ASSERT(_Condition) __glibcxx_assert(_Condition)