Changeset View
Changeset View
Standalone View
Standalone View
test/std/algorithms/alg.nonmodifying/nth_element.pass.cpp
- This file was moved from test/test_nth_element.cpp.
// -*- C++ -*- | // -*- C++ -*- | ||||
//===-- test_nth_element.cpp ----------------------------------------------===// | //===-- nth_element.pass.cpp ----------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "pstl_test_config.h" | #include "support/pstl_test_config.h" | ||||
#include <algorithm> | #ifdef PSTL_STANDALONE_TESTS | ||||
#include <iostream> | |||||
#include "pstl/execution" | #include "pstl/execution" | ||||
#include "pstl/algorithm" | #include "pstl/algorithm" | ||||
#else | |||||
#include <execution> | |||||
#include <algorithm> | |||||
#endif // PSTL_STANDALONE_TESTS | |||||
#include "utils.h" | #include "support/parallel_utils.h" | ||||
using namespace TestUtils; | using namespace Parallel_TestUtils; | ||||
// User defined type with minimal requirements | // User defined type with minimal requirements | ||||
template <typename T> | template <typename T> | ||||
struct DataType | struct DataType | ||||
{ | { | ||||
explicit DataType(int32_t k) : my_val(k) {} | explicit DataType(int32_t k) : my_val(k) {} | ||||
DataType(DataType&& input) | DataType(DataType&& input) | ||||
{ | { | ||||
Show All 38 Lines | |||||
} | } | ||||
struct test_one_policy | struct test_one_policy | ||||
{ | { | ||||
#if __PSTL_ICC_17_VC141_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN || \ | #if __PSTL_ICC_17_VC141_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN || \ | ||||
__PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration | __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration | ||||
template <typename Iterator1, typename Size, typename Generator1, typename Generator2, typename Compare> | template <typename Iterator1, typename Size, typename Generator1, typename Generator2, typename Compare> | ||||
typename std::enable_if<is_same_iterator_category<Iterator1, std::random_access_iterator_tag>::value, void>::type | typename std::enable_if<is_same_iterator_category<Iterator1, std::random_access_iterator_tag>::value, void>::type | ||||
operator()(pstl::execution::unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, | operator()(__pstl::execution::unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, | ||||
Iterator1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) | Iterator1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) | ||||
{ | { | ||||
} | } | ||||
template <typename Iterator1, typename Size, typename Generator1, typename Generator2, typename Compare> | template <typename Iterator1, typename Size, typename Generator1, typename Generator2, typename Compare> | ||||
typename std::enable_if<is_same_iterator_category<Iterator1, std::random_access_iterator_tag>::value, void>::type | typename std::enable_if<is_same_iterator_category<Iterator1, std::random_access_iterator_tag>::value, void>::type | ||||
operator()(pstl::execution::parallel_unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, | operator()(__pstl::execution::parallel_unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, | ||||
Iterator1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) | Iterator1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) | ||||
{ | { | ||||
} | } | ||||
#endif | #endif | ||||
// nth_element works only with random access iterators | // nth_element works only with random access iterators | ||||
template <typename Policy, typename Iterator1, typename Size, typename Generator1, typename Generator2, | template <typename Policy, typename Iterator1, typename Size, typename Generator1, typename Generator2, | ||||
typename Compare> | typename Compare> | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |