/* * Copyright 2008-2013 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) # pragma clang system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) # pragma system_header #endif // no system header #include #include #include #include THRUST_NAMESPACE_BEGIN namespace detail { namespace functional { template _CCCL_HOST_DEVICE actor>, actor>> _CCCL_HOST_DEVICE operator-(const actor& _1) { return compose(transparent_unary_operator>(), _1); } // end operator-() // there's no standard unary_plus functional, so roll an ad hoc one here struct unary_plus { using is_transparent = void; _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(+THRUST_FWD(t1))) THRUST_TRAILING_RETURN(decltype(+THRUST_FWD(t1))) { return +THRUST_FWD(t1); } }; template _CCCL_HOST_DEVICE actor, actor>> operator+(const actor& _1) { return compose(transparent_unary_operator(), _1); } // end operator+() template _CCCL_HOST_DEVICE actor>, actor, typename as_actor::type>> operator+(const actor& _1, const T2& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator+() template _CCCL_HOST_DEVICE actor>, typename as_actor::type, actor>> operator+(const T1& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator+() template _CCCL_HOST_DEVICE actor>, actor, actor>> operator+(const actor& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator+() template _CCCL_HOST_DEVICE actor>, typename as_actor::type, actor>> operator-(const T1& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator-() template _CCCL_HOST_DEVICE actor>, actor, typename as_actor::type>> operator-(const actor& _1, const T2& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator-() template _CCCL_HOST_DEVICE actor>, actor, actor>> operator-(const actor& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator-() template _CCCL_HOST_DEVICE actor>, typename as_actor::type, actor>> operator*(const T1& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator*() template _CCCL_HOST_DEVICE actor>, actor, typename as_actor::type>> operator*(const actor& _1, const T2& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator*() template _CCCL_HOST_DEVICE actor>, actor, actor>> operator*(const actor& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator*() template _CCCL_HOST_DEVICE actor>, actor, typename as_actor::type>> operator/(const actor& _1, const T2& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator/() template _CCCL_HOST_DEVICE actor>, typename as_actor::type, actor>> operator/(const T1& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator/() template _CCCL_HOST_DEVICE actor>, actor, actor>> operator/(const actor& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator/() template _CCCL_HOST_DEVICE actor>, actor, typename as_actor::type>> operator%(const actor& _1, const T2& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator%() template _CCCL_HOST_DEVICE actor>, typename as_actor::type, actor>> operator%(const T1& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator%() template _CCCL_HOST_DEVICE actor>, actor, actor>> operator%(const actor& _1, const actor& _2) { return compose(transparent_binary_operator>(), make_actor(_1), make_actor(_2)); } // end operator%() // there's no standard prefix_increment functional, so roll an ad hoc one here struct prefix_increment { using is_transparent = void; _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(++THRUST_FWD(t1))) THRUST_TRAILING_RETURN(decltype(++THRUST_FWD(t1))) { return ++THRUST_FWD(t1); } }; // end prefix_increment template _CCCL_HOST_DEVICE actor, actor>> operator++(const actor& _1) { return compose(transparent_unary_operator(), _1); } // end operator++() // there's no standard postfix_increment functional, so roll an ad hoc one here struct postfix_increment { using is_transparent = void; _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(THRUST_FWD(t1)++)) THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1)++)) { return THRUST_FWD(t1)++; } }; // end postfix_increment template _CCCL_HOST_DEVICE actor, actor>> operator++(const actor& _1, int) { return compose(transparent_unary_operator(), _1); } // end operator++() // there's no standard prefix_decrement functional, so roll an ad hoc one here struct prefix_decrement { using is_transparent = void; _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(--THRUST_FWD(t1))) THRUST_TRAILING_RETURN(decltype(--THRUST_FWD(t1))) { return --THRUST_FWD(t1); } }; // end prefix_decrement template _CCCL_HOST_DEVICE actor, actor>> operator--(const actor& _1) { return compose(transparent_unary_operator(), _1); } // end operator--() // there's no standard postfix_decrement functional, so roll an ad hoc one here struct postfix_decrement { using is_transparent = void; _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(THRUST_FWD(t1)--)) THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1)--)) { return THRUST_FWD(t1)--; } }; // end prefix_increment template _CCCL_HOST_DEVICE actor, actor>> operator--(const actor& _1, int) { return compose(transparent_unary_operator(), _1); } // end operator--() } // namespace functional } // namespace detail THRUST_NAMESPACE_END