summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/algorithmfwd.h56
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h46
2 files changed, 87 insertions, 15 deletions
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index 992dc4f5afe..fa4e72cd412 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -25,9 +25,12 @@
/*
adjacent_find
+ all_of (C++0x)
+ any_of (C++0x)
binary_search
copy
copy_backward
+ copy_if (C++0x)
count
count_if
equal
@@ -38,6 +41,7 @@
find_end
find_first_of
find_if
+ find_if_not (C++0x)
for_each
generate
generate_n
@@ -60,10 +64,12 @@
minmax_element (C++0x)
mismatch
next_permutation
+ none_of (C++0x)
nth_element
partial_sort
partial_sort_copy
partition
+ partition_copy (C++0x)
pop_heap
prev_permutation
push_heap
@@ -111,6 +117,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// adjacent_find
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _Predicate>
+ bool
+ all_of(_IIter, _IIter, _Predicate);
+
+ template<typename _IIter, typename _Predicate>
+ bool
+ any_of(_IIter, _IIter, _Predicate);
+#endif
+
template<typename _FIter, typename _Tp>
bool
binary_search(_FIter, _FIter, const _Tp&);
@@ -127,6 +143,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_BIter2
copy_backward(_BIter1, _BIter1, _BIter2);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _OIter, typename _Predicate>
+ _OIter
+ copy_if(_IIter, _IIter, _OIter, _Predicate);
+#endif
+
// count
// count_if
@@ -165,28 +187,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// find_first_of
// find_if
- // for_each
- // generate
- // generate_n
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _IIter, typename _Predicate>
- bool
- all_of(_IIter, _IIter, _Predicate);
-
- template<typename _IIter, typename _Predicate>
- bool
- any_of(_IIter, _IIter, _Predicate);
-
- template<typename _IIter, typename _Predicate>
- bool
- none_of(_IIter, _IIter, _Predicate);
-
- template<typename _IIter, typename _Predicate>
_IIter
find_if_not(_IIter, _IIter, _Predicate);
#endif
+ // for_each
+ // generate
+ // generate_n
+
template<typename _IIter1, typename _IIter2>
bool
includes(_IIter1, _IIter1, _IIter2, _IIter2);
@@ -306,6 +317,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
bool
next_permutation(_BIter, _BIter, _Compare);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _Predicate>
+ bool
+ none_of(_IIter, _IIter, _Predicate);
+#endif
+
// nth_element
// partial_sort
@@ -317,6 +334,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_RAIter
partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare);
+ // partition
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _OIter1,
+ typename _OIter2, typename _Predicate>
+ pair<_OIter1, _OIter2>
+ partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate);
+#endif
+
template<typename _RAIter>
void
pop_heap(_RAIter, _RAIter);
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index cee7d613d6a..43b0582db74 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -911,6 +911,52 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
return __result;
}
+
+ /**
+ * @brief Copy the elements of a sequence to separate output sequences
+ * depending on the truth value of a predicate.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param out_true An output iterator.
+ * @param out_false An output iterator.
+ * @param pred A predicate.
+ * @return A pair designating the ends of the resulting sequences.
+ *
+ * Copies each element in the range @p [first,last) for which
+ * @p pred returns true to the range beginning at @p out_true
+ * and each element for which @p pred returns false to @p out_false.
+ */
+ template<typename _InputIterator, typename _OutputIterator1,
+ typename _OutputIterator2, typename _Predicate>
+ pair<_OutputIterator1, _OutputIterator2>
+ partition_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator1 __out_true, _OutputIterator2 __out_false,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator1,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator2,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ {
+ *__out_true = *__first;
+ ++__out_true;
+ }
+ else
+ {
+ *__out_false = *__first;
+ ++__out_false;
+ }
+
+ return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false);
+ }
#endif
/**
OpenPOWER on IntegriCloud