diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-27 10:47:27 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-27 10:47:27 +0000 |
commit | 6e48a8d02f9025fb6de6a08b01d24c62ff658100 (patch) | |
tree | 7268855da81f3e3081198a9735a8844ca3bbd850 /libstdc++-v3/include/bits/stl_numeric.h | |
parent | deb74db2d98b0e59d053e268412fc6a49f6a7e7f (diff) | |
download | gcc-6e48a8d02f9025fb6de6a08b01d24c62ff658100.tar.gz |
2008-06-27 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_numeric.h (iota): Add in C++0x mode.
* testsuite/util/testsuite_character.h (pod_int): Add operator++
in C++0x mode.
* testsuite/util/testsuite_api.h (NonDefaultConstructible): Likewise.
* testsuite/26_numerics/iota/1.cc: New.
* testsuite/26_numerics/iota/requirements/explicit_instantiation/
2.cc: Likewise.
* testsuite/26_numerics/iota/requirements/explicit_instantiation/
pod.cc: Likewise.
* include/ext/algorithm: Do not fiddle with the legacy headers.
* testsuite/26_numerics/partial_sum/1.cc: Minor changes, comments,
style.
* testsuite/26_numerics/accumulate/1.cc: Likewise.
* testsuite/26_numerics/adjacent_difference/1.cc: Likewise.
* testsuite/26_numerics/inner_product/1.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137174 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/stl_numeric.h')
-rw-r--r-- | libstdc++-v3/include/bits/stl_numeric.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/stl_numeric.h b/libstdc++-v3/include/bits/stl_numeric.h index 3940e4aa970..c86122679da 100644 --- a/libstdc++-v3/include/bits/stl_numeric.h +++ b/libstdc++-v3/include/bits/stl_numeric.h @@ -1,6 +1,6 @@ // Numeric functions implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -65,6 +65,43 @@ #include <bits/concept_check.h> #include <debug/debug.h> +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** + * @brief Create a range of sequentially increasing values. + * + * For each element in the range @p [first,last) assigns @p value and + * increments @p value as if by @p ++value. + * + * @param first Start of range. + * @param last End of range. + * @param value Starting value. + * @return Nothing. + */ + template<typename _ForwardIterator, typename _Tp> + void + iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + { + *__first = __value; + ++__value; + } + } + +_GLIBCXX_END_NAMESPACE + +#endif + _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P) /** @@ -164,7 +201,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P) * @return The final inner product. */ template<typename _InputIterator1, typename _InputIterator2, typename _Tp, - typename _BinaryOperation1, typename _BinaryOperation2> + typename _BinaryOperation1, typename _BinaryOperation2> inline _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, |