1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template<ForwardIterator Iter, Predicate<auto, Iter::value_type> Pred, class T>
13 // requires OutputIterator<Iter, Iter::reference>
14 // && OutputIterator<Iter, const T&>
15 // && CopyConstructible<Pred>
17 // replace_if(Iter first, Iter last, Pred pred, const T& new_value);
23 #include "test_iterators.h"
25 bool equalToTwo(int v) { return v == 2; }
31 int ia[] = {0, 1, 2, 3, 4};
32 const unsigned sa = sizeof(ia)/sizeof(ia[0]);
33 std::replace_if(Iter(ia), Iter(ia+sa), equalToTwo, 5);
43 test<forward_iterator<int*> >();
44 test<bidirectional_iterator<int*> >();
45 test<random_access_iterator<int*> >();