8 #ifndef CUDA_KAT_UTILITY_HPP_ 9 #define CUDA_KAT_UTILITY_HPP_ 13 #include <type_traits> 17 #include <kat/detail/execution_space_specifiers.hpp> 19 #include <kat/detail/integer_sequence.hpp> 24 #ifdef KAT_DEFINE_MOVE_AND_FORWARD 26 constexpr KAT_FHD
typename std::remove_reference<T>::type&& move(T&& v) noexcept
28 return static_cast<typename std::remove_reference<T>::type&&
>(v);
32 constexpr KAT_FHD T&& forward(
typename std::remove_reference<T>::type& v) noexcept
34 return static_cast<T&&
>(v);
38 constexpr KAT_FHD T&& forward(
typename std::remove_reference<T>::type&& v) noexcept
40 return static_cast<T&&
>(v);
44 #if __cplusplus >= 201401L 45 template <
typename T,
typename U = T>
46 constexpr KAT_FHD
auto exchange (T& x, U&& new_value)
48 #ifndef KAT_DEFINE_MOVE_AND_FORWARD 52 auto old_value = move(x);
53 x = forward<T>(new_value);
56 #endif // __cplusplus >= 201401L 73 KAT_FHD CONSTEXPR_SINCE_CPP_14
void swap( T& a, T& b )
75 std::is_nothrow_move_constructible<T>::value &&
76 std::is_nothrow_move_assignable<T>::value
79 #ifndef KAT_DEFINE_MOVE_AND_FORWARD 95 KAT_FHD
operator T& ()
const {
return v_; }
98 KAT_FHD addr_impl_ref & operator=(
const addr_impl_ref &);
104 static KAT_FHD T* f( T& v,
long ) {
105 return reinterpret_cast<T*
>(
106 &
const_cast<char&
>(
reinterpret_cast<const volatile char &
>(v)));
109 static KAT_FHD T* f( T* v,
int ) {
return v; }
130 const KAT_FHD T*
addressof(
const T&&) =
delete;
134 #endif // CUDA_KAT_UTILITY_HPP_ KAT_FHD T * addressof(T &v)
Obtains the actual address of the object or function arg, even in presence of overloaded operator&() ...
Definition: utility.hpp:122
Definition: common.hpp:16
Definition: utility.hpp:90
Basic type and macro definitions used throughout the KAT library.
Definition: utility.hpp:102