24 #include <thrust/detail/config.h> 26 #include <thrust/detail/functional/placeholder.h> 28 THRUST_NAMESPACE_BEGIN
33 template<
typename Operation>
struct unary_traits;
35 template<
typename Operation>
struct binary_traits;
67 template<
typename Argument,
107 template<
typename Argument1,
141 #define THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(func, impl) \ 145 using is_transparent = void; \ 146 __thrust_exec_check_disable__ \ 147 template <typename T> \ 148 __host__ __device__ \ 149 constexpr auto operator()(T&& x) const \ 150 noexcept(noexcept(impl)) THRUST_TRAILING_RETURN(decltype(impl)) \ 156 #define THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION(func, impl) \ 160 using is_transparent = void; \ 161 __thrust_exec_check_disable__ \ 162 template <typename T1, typename T2> \ 163 __host__ __device__ \ 164 constexpr auto operator()(T1&& t1, T2&& t2) const \ 165 noexcept(noexcept(impl)) THRUST_TRAILING_RETURN(decltype(impl)) \ 171 #define THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(func, op) \ 172 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION( \ 173 func, THRUST_FWD(t1) op THRUST_FWD(t2)) 209 template<
typename T =
void>
229 __thrust_exec_check_disable__
231 constexpr T operator()(
const T &lhs,
const T &rhs)
const 237 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
plus, +);
272 template<
typename T =
void>
292 __thrust_exec_check_disable__
294 constexpr T operator()(
const T &lhs,
const T &rhs)
const 300 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
minus, -);
335 template<
typename T =
void>
355 __thrust_exec_check_disable__
357 constexpr T operator()(
const T &lhs,
const T &rhs)
const 363 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
multiplies, *);
398 template<
typename T =
void>
418 __thrust_exec_check_disable__
420 constexpr T operator()(
const T &lhs,
const T &rhs)
const 426 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
divides, /);
461 template<
typename T =
void>
481 __thrust_exec_check_disable__
483 constexpr T operator()(
const T &lhs,
const T &rhs)
const 489 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
modulus, %);
521 template<
typename T =
void>
536 __thrust_exec_check_disable__
538 constexpr T operator()(
const T &x)
const 544 THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(
negate, -THRUST_FWD(x));
575 template<
typename T =
void>
590 __thrust_exec_check_disable__
592 constexpr T operator()(
const T &x)
const 598 THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(
square, x*x);
619 template<
typename T =
void>
625 typedef T first_argument_type;
630 typedef T second_argument_type;
639 __thrust_exec_check_disable__
641 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 647 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
equal_to, ==);
660 template<
typename T =
void>
680 __thrust_exec_check_disable__
682 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 688 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
not_equal_to, !=);
701 template<
typename T =
void>
721 __thrust_exec_check_disable__
723 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 729 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
greater, >);
742 template<
typename T =
void>
762 __thrust_exec_check_disable__
764 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 770 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
less, <);
783 template<
typename T =
void>
803 __thrust_exec_check_disable__
805 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 811 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
greater_equal, >=);
824 template<
typename T =
void>
844 __thrust_exec_check_disable__
846 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 852 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
less_equal, <=);
874 template<
typename T =
void>
894 __thrust_exec_check_disable__
896 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 902 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
logical_and, &&);
915 template<
typename T =
void>
935 __thrust_exec_check_disable__
937 constexpr
bool operator()(
const T &lhs,
const T &rhs)
const 943 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
logical_or, ||);
970 template<
typename T =
void>
990 __thrust_exec_check_disable__
992 constexpr
bool operator()(
const T &x)
const 998 THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(
logical_not, !THRUST_FWD(x));
1040 template<
typename T =
void>
1060 __thrust_exec_check_disable__
1062 constexpr T operator()(
const T &lhs,
const T &rhs)
const 1068 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
bit_and, &);
1102 template<
typename T =
void>
1122 __thrust_exec_check_disable__
1124 constexpr T operator()(
const T &lhs,
const T &rhs)
const 1130 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
bit_or, |);
1164 template<
typename T =
void>
1184 __thrust_exec_check_disable__
1186 constexpr T operator()(
const T &lhs,
const T &rhs)
const 1192 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(
bit_xor, ^);
1222 template<
typename T =
void>
1237 __thrust_exec_check_disable__
1239 constexpr
const T &operator()(
const T &x)
const 1245 THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(
identity, THRUST_FWD(x));
1271 template<
typename T =
void>
1291 __thrust_exec_check_disable__
1293 constexpr T operator()(
const T &lhs,
const T &rhs)
const 1295 return lhs < rhs ? rhs : lhs;
1299 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION(
maximum,
1300 t1 < t2 ? THRUST_FWD(t2)
1327 template<
typename T =
void>
1347 __thrust_exec_check_disable__
1349 constexpr T operator()(
const T &lhs,
const T &rhs)
const 1351 return lhs < rhs ? lhs : rhs;
1355 THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION(
minimum,
1356 t1 < t2 ? THRUST_FWD(t1)
1377 template<
typename T1 =
void,
typename T2 =
void>
1398 constexpr
const T1 &operator()(
const T1 &lhs,
const T2 & )
const 1407 using is_transparent = void;
1408 __thrust_exec_check_disable__
1409 template <
typename T1,
typename T2>
1411 constexpr
auto operator()(T1&& t1, T2&&)
const 1412 noexcept(noexcept(THRUST_FWD(t1)))
1413 THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1)))
1415 return THRUST_FWD(t1);
1437 template<
typename T1 =
void,
typename T2 =
void>
1458 constexpr
const T2 &operator()(
const T1 &,
const T2 &rhs)
const 1467 using is_transparent = void;
1468 __thrust_exec_check_disable__
1469 template <
typename T1,
typename T2>
1471 constexpr
auto operator()(T1&&, T2&& t2)
const 1472 noexcept(noexcept(THRUST_FWD(t2)))
1473 THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t2)))
1475 return THRUST_FWD(t2);
1499 template<
typename Predicate>
1511 __thrust_exec_check_disable__
1513 bool operator()(
const typename Predicate::argument_type& x) {
return !pred(x); }
1538 template<
typename Predicate>
1552 template<
typename Predicate>
1555 typename Predicate::second_argument_type,
1566 __thrust_exec_check_disable__
1568 bool operator()(
const typename Predicate::first_argument_type& x,
const typename Predicate::second_argument_type& y)
1596 template<
typename BinaryPredicate>
1652 namespace placeholders
1658 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<0>::type
_1;
1663 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<1>::type
_2;
1668 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<2>::type
_3;
1673 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<3>::type
_4;
1678 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<4>::type
_5;
1683 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<5>::type
_6;
1688 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<6>::type
_7;
1693 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<7>::type
_8;
1698 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<8>::type
_9;
1703 THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder<9>::type
_10;
1712 #undef THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION 1713 #undef THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION 1714 #undef THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP 1716 THRUST_NAMESPACE_END
1718 #include <thrust/detail/functional.inl> 1719 #include <thrust/detail/functional/operators.h> T second_argument_type
The type of the function object's second argument.
Definition: functional.h:1109
Definition: functional.h:1099
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:1166
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:669
Definition: functional.h:1267
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:282
bool result_type
The type of the function object's result;.
Definition: functional.h:715
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 0 >::type _1
Definition: functional.h:1651
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:1047
Definition: functional.h:968
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:345
Definition: functional.h:1547
Definition: functional.h:461
Definition: functional.h:1433
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:1272
Definition: functional.h:872
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:277
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 9 >::type _10
Definition: functional.h:1696
T result_type
The type of the function object's result;.
Definition: functional.h:287
Definition: functional.h:69
bool result_type
The type of the function object's result;.
Definition: functional.h:756
Definition: functional.h:823
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 4 >::type _5
Definition: functional.h:1671
Definition: functional.h:209
T result_type
The type of the function object's result;.
Definition: functional.h:531
T1 result_type
The type of the function object's result;.
Definition: functional.h:1388
Definition: functional.h:659
T result_type
The type of the function object's result;.
Definition: functional.h:476
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:623
Definition: functional.h:521
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:628
bool result_type
The type of the function object's result;.
Definition: functional.h:633
T result_type
The type of the function object's result;.
Definition: functional.h:1282
T result_type
The type of the function object's result;.
Definition: functional.h:350
T result_type
The type of the function object's result;.
Definition: functional.h:585
T1 first_argument_type
The type of the function object's first argument.
Definition: functional.h:1378
Argument1 first_argument_type
The type of the function object's first argument.
Definition: functional.h:115
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:214
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:833
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:1328
T result_type
The type of the function object's result;.
Definition: functional.h:1338
T result_type
The type of the function object's result;.
Definition: functional.h:413
T2 result_type
The type of the function object's result;.
Definition: functional.h:1448
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 8 >::type _9
Definition: functional.h:1691
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:746
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 6 >::type _7
Definition: functional.h:1681
Definition: functional.h:110
Definition: functional.h:335
T argument_type
The type of the function object's argument.
Definition: functional.h:580
T1 first_argument_type
The type of the function object's first argument.
Definition: functional.h:1438
Definition: functional.h:1218
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:340
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:792
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:787
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:1042
Definition: functional.h:741
__host__ __device__ unary_negate< Predicate > not1(const Predicate &pred)
bool result_type
The type of the function object's result;.
Definition: functional.h:674
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 5 >::type _6
Definition: functional.h:1676
Definition: functional.h:618
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:408
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:1171
Argument argument_type
The type of the function object's argument.
Definition: functional.h:74
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:1333
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:705
T result_type
The type of the function object's result;.
Definition: functional.h:1114
Definition: functional.h:1373
Result result_type
The type of the function object's result;.
Definition: functional.h:125
T result_type
The type of the function object's result;.
Definition: functional.h:1052
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:751
Definition: functional.h:1323
T result_type
The type of the function object's result;.
Definition: functional.h:1228
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 7 >::type _8
Definition: functional.h:1686
Result result_type
The type of the function object's result.
Definition: functional.h:79
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:403
bool result_type
The type of the function object's result;.
Definition: functional.h:838
Definition: functional.h:913
T argument_type
The type of the function object's first argument.
Definition: functional.h:1223
bool result_type
The type of the function object's result;.
Definition: functional.h:797
__host__ __device__ binary_negate< BinaryPredicate > not2(const BinaryPredicate &pred)
Definition: functional.h:782
Definition: functional.h:1494
T result_type
The type of the function object's result;.
Definition: functional.h:224
Definition: functional.h:1037
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:664
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:828
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:219
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:710
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:1104
T2 second_argument_type
The type of the function object's second argument.
Definition: functional.h:1443
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 2 >::type _3
Definition: functional.h:1661
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 1 >::type _2
Definition: functional.h:1656
THRUST_INLINE_CONSTANT thrust::detail::functional::placeholder< 3 >::type _4
Definition: functional.h:1666
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:1277
Definition: functional.h:575
T2 second_argument_type
The type of the function object's second argument.
Definition: functional.h:1383
T argument_type
The type of the function object's argument.
Definition: functional.h:526
T second_argument_type
The type of the function object's second argument.
Definition: functional.h:471
Definition: functional.h:398
Definition: functional.h:700
Argument2 second_argument_type
The type of the function object's second argument.
Definition: functional.h:120
Definition: functional.h:272
T first_argument_type
The type of the function object's first argument.
Definition: functional.h:466
T result_type
The type of the function object's result;.
Definition: functional.h:1176
Definition: functional.h:1161