From 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 6 Sep 2015 18:46:46 +0000 Subject: Import libc++ 3.7.0 release (r246257). --- .../alg.partitions/partition_copy.pass.cpp | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp (limited to 'test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp') diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp new file mode 100644 index 0000000000000..67e1cccaf730c --- /dev/null +++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// pair +// partition_copy(InputIterator first, InputIterator last, +// OutputIterator1 out_true, OutputIterator2 out_false, +// Predicate pred); + +#include +#include + +#include "test_iterators.h" + +struct is_odd +{ + bool operator()(const int& i) const {return i & 1;} +}; + +int main() +{ + { + const int ia[] = {1, 2, 3, 4, 6, 8, 5, 7}; + int r1[10] = {0}; + int r2[10] = {0}; + typedef std::pair, int*> P; + P p = std::partition_copy(input_iterator(std::begin(ia)), + input_iterator(std::end(ia)), + output_iterator(r1), r2, is_odd()); + assert(p.first.base() == r1 + 4); + assert(r1[0] == 1); + assert(r1[1] == 3); + assert(r1[2] == 5); + assert(r1[3] == 7); + assert(p.second == r2 + 4); + assert(r2[0] == 2); + assert(r2[1] == 4); + assert(r2[2] == 6); + assert(r2[3] == 8); + } +} -- cgit v1.2.3