32 #ifndef _GLIBCXX_PARALLEL_BASE_H
33 #define _GLIBCXX_PARALLEL_BASE_H 1
50 namespace __parallel { }
70 #ifdef _GLIBCXX_PARALLEL
71 using namespace std::__norm;
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>
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) { }
414 {
return iterator(val, 0); }
419 {
return iterator(val, 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)
Similar to std::multiplies, but allows two different types.
Similar to std::plus, but allows two different types.
Defines on whether to include algorithm variants.
Size __log2(Size n)
Calculates the rounded-down logarithm of n for base 2.
ISO C++ entities toplevel namespace is std.
GNU sequential classes for public use.
Similar to std::binder2nd, but giving the argument types explicitly.
GNU parallel code for public use.
pseudo_sequence(const T &val, difference_type count)
Constructor.
Constructs predicate for equality from strict weak ordering predicate.
_Parallelism
Run-time equivalents for the compile-time tags.
argument_type argument_type
argument_type is the type of the argument (no surprises here)
Sequence that conceptually consists of multiple copies of the same element. The copies are not stored...
const T & max(const T &a, const T &b)
Equivalent to std::max.
Similar to std::binder1st, but giving the argument types explicitly.
Similar to std::binder1st, but giving the argument types explicitly.
lcas_t encode2(int a, int b)
Encode two integers into one __gnu_parallel::lcas_t.
static const lcas_t lcas_t_mask
lcas_t with the right half of bits set to 1.
void decode2(lcas_t x, int &a, int &b)
Decode two integers from one __gnu_parallel::lcas_t.
const T & min(const T &a, const T &b)
Equivalent to std::min.
int64 lcas_t
Longest compare-and-swappable integer type on this platform.
Includes the original header files concerned with iterators except for stream iterators. This file is a GNU parallel extension to the Standard C++ Library.
Iterator associated with __gnu_parallel::pseudo_sequence. If features the usual random-access iterato...
RandomAccessIterator median_of_three_iterators(RandomAccessIterator a, RandomAccessIterator b, RandomAccessIterator c, Comparator &comp)
Compute the median of three referenced elements, according to comp.
Similar to std::equal_to, but allows two different types.
Similar to std::less, but allows two different types.
End-user include file. Provides advanced settings and tuning options. This file is a GNU parallel ext...
static const int lcas_t_bits
Number of bits of lcas_t.
GNU parallel code, replaces standard behavior with parallel behavior.
Functor that does nothing.
iterator end() const
End iterator.
result_type result_type
result_type is the return type
iterator begin() const
Begin iterator.