summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/parallel/checkers.h
diff options
context:
space:
mode:
authorJohannes Singler <singler@ira.uka.de>2009-09-17 08:42:39 +0000
committerJohannes Singler <singler@gcc.gnu.org>2009-09-17 08:42:39 +0000
commit15ac3c72db8333d4a63e43949121e5d7f7c2fb78 (patch)
tree11ed989c17b3740ffef24792c7397b0fbce1f891 /libstdc++-v3/include/parallel/checkers.h
parent10e154dfd7e4e61f1205a364d07ec0789c85bfd3 (diff)
downloadgcc-15ac3c72db8333d4a63e43949121e5d7f7c2fb78.tar.gz
algobase.h: Replace tabs by spaces; correct line breaks.
2009-09-17 Johannes Singler <singler@ira.uka.de> * include/parallel/algobase.h: Replace tabs by spaces; correct line breaks. * include/parallel/algorithmfwd.h: Likewise. * include/parallel/balanced_quicksort.h: Likewise. * include/parallel/base.h: Likewise. * include/parallel/checkers.h: Likewise. * include/parallel/compatibility.h: Likewise. * include/parallel/equally_split.h: Likewise. * include/parallel/find.h: Likewise. * include/parallel/for_each.h: Likewise. * include/parallel/for_each_selectors.h: Likewise. * include/parallel/iterator.h: Likewise. * include/parallel/list_partition.h: Likewise. * include/parallel/losertree.h: Likewise. * include/parallel/merge.h: Likewise. * include/parallel/multiseq_selection.h: Likewise. * include/parallel/multiway_merge.h: Likewise. * include/parallel/multiway_mergesort.h: Likewise. * include/parallel/numeric: Likewise. * include/parallel/numericfwd.h: Likewise. * include/parallel/omp_loop.h: Likewise. * include/parallel/omp_loop_static.h: Likewise. * include/parallel/par_loop.h: Likewise. * include/parallel/partial_sum.h: Likewise. * include/parallel/partition.h: Likewise. * include/parallel/queue.h: Likewise. * include/parallel/quicksort.h: Likewise. * include/parallel/random_number.h: Likewise. * include/parallel/random_shuffle.h: Likewise. * include/parallel/search.h: Likewise. * include/parallel/set_operations.h: Likewise. * include/parallel/settings.h: Likewise. * include/parallel/sort.h: Likewise. * include/parallel/types.h: Likewise. * include/parallel/unique_copy.h: Likewise. * include/parallel/workstealing.h: Likewise. * include/parallel/algo.h: Likewise; shorten _ForwardIterator to _FIterator. * include/parallel/find_selectors.h: Likewise. From-SVN: r151791
Diffstat (limited to 'libstdc++-v3/include/parallel/checkers.h')
-rw-r--r--libstdc++-v3/include/parallel/checkers.h95
1 files changed, 49 insertions, 46 deletions
diff --git a/libstdc++-v3/include/parallel/checkers.h b/libstdc++-v3/include/parallel/checkers.h
index 47d21749a86..5d3acfa4b8d 100644
--- a/libstdc++-v3/include/parallel/checkers.h
+++ b/libstdc++-v3/include/parallel/checkers.h
@@ -39,7 +39,8 @@
namespace __gnu_parallel
{
/**
- * @brief Check whether @__c [__begin, @__c __end) is sorted according to @__c __comp.
+ * @brief Check whether @__c [__begin, @__c __end) is sorted according
+ * to @__c __comp.
* @param __begin Begin iterator of sequence.
* @param __end End iterator of sequence.
* @param __comp Comparator.
@@ -49,33 +50,34 @@ namespace __gnu_parallel
template<typename _IIter, typename _Compare>
bool
__is_sorted(_IIter __begin, _IIter __end,
- _Compare __comp
- = std::less<typename std::iterator_traits<_IIter>::
- _ValueType>())
+ _Compare __comp
+ = std::less<typename std::iterator_traits<_IIter>::
+ _ValueType>())
{
if (__begin == __end)
- return true;
+ return true;
_IIter __current(__begin), __recent(__begin);
unsigned long long __position = 1;
for (__current++; __current != __end; __current++)
- {
- if (__comp(*__current, *__recent))
- {
- printf("__is_sorted: check failed before position %__i.\n",
- __position);
- return false;
- }
- __recent = __current;
- __position++;
- }
+ {
+ if (__comp(*__current, *__recent))
+ {
+ printf("__is_sorted: check failed before position %__i.\n",
+ __position);
+ return false;
+ }
+ __recent = __current;
+ __position++;
+ }
return true;
}
/**
- * @brief Check whether @__c [__begin, @__c __end) is sorted according to @__c __comp.
+ * @brief Check whether @__c [__begin, @__c __end) is sorted according to
+ * @__c __comp.
* Prints the position in case an unordered pair is found.
* @param __begin Begin iterator of sequence.
* @param __end End iterator of sequence.
@@ -87,36 +89,37 @@ namespace __gnu_parallel
template<typename _IIter, typename _Compare>
bool
is_sorted_failure(_IIter __begin, _IIter __end,
- _IIter& __first_failure,
- _Compare __comp
- = std::less<typename std::iterator_traits<_IIter>::
- _ValueType>())
+ _IIter& __first_failure,
+ _Compare __comp
+ = std::less<typename std::iterator_traits<_IIter>::
+ _ValueType>())
{
if (__begin == __end)
- return true;
+ return true;
_IIter __current(__begin), __recent(__begin);
unsigned long long __position = 1;
for (__current++; __current != __end; __current++)
- {
- if (__comp(*__current, *__recent))
- {
- __first_failure = __current;
- printf("__is_sorted: check failed before position %lld.\n",
- __position);
- return false;
- }
- __recent = __current;
- __position++;
- }
+ {
+ if (__comp(*__current, *__recent))
+ {
+ __first_failure = __current;
+ printf("__is_sorted: check failed before position %lld.\n",
+ __position);
+ return false;
+ }
+ __recent = __current;
+ __position++;
+ }
__first_failure = __end;
return true;
}
/**
- * @brief Check whether @__c [__begin, @__c __end) is sorted according to @__c __comp.
+ * @brief Check whether @__c [__begin, @__c __end) is sorted according to
+ * @__c __comp.
* Prints all unordered pair, including the surrounding two elements.
* @param __begin Begin iterator of sequence.
* @param __end End iterator of sequence.
@@ -127,26 +130,26 @@ namespace __gnu_parallel
bool
// XXX Compare default template argument
is_sorted_print_failures(_IIter __begin, _IIter __end,
- _Compare __comp
- = std::less<typename std::iterator_traits
- <_IIter>::value_type>())
+ _Compare __comp
+ = std::less<typename std::iterator_traits
+ <_IIter>::value_type>())
{
if (__begin == __end)
- return true;
+ return true;
_IIter __recent(__begin);
bool __ok = true;
for (_IIter __pos(__begin + 1); __pos != __end; __pos++)
- {
- if (__comp(*__pos, *__recent))
- {
- printf("%ld: %d %d %d %d\n", __pos - __begin, *(__pos - 2),
- *(__pos- 1), *__pos, *(__pos + 1));
- __ok = false;
- }
- __recent = __pos;
- }
+ {
+ if (__comp(*__pos, *__recent))
+ {
+ printf("%ld: %d %d %d %d\n", __pos - __begin, *(__pos - 2),
+ *(__pos- 1), *__pos, *(__pos + 1));
+ __ok = false;
+ }
+ __recent = __pos;
+ }
return __ok;
}
}