stdgpu/utility.h Source File — stdgpu Latest documentation (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16#ifndef STDGPU_UTILITY_H

17#define STDGPU_UTILITY_H

18

28#include <type_traits>

29

32

33namespace stdgpu

34{

35

42template <typename T1, typename T2>

44{

52

56 template <STDGPU_DETAIL_OVERLOAD_IF(std::is_default_constructible_v&& std::is_default_constructible_v)>

59

65 template <STDGPU_DETAIL_OVERLOAD_IF(std::is_copy_constructible_v&& std::is_copy_constructible_v)>

67 pair(const T1& x, const T2& y);

68

76 template <class U1 = T1,

77 class U2 = T2,

78 STDGPU_DETAIL_OVERLOAD_IF(std::is_constructible_v<T1, U1>&& std::is_constructible_v<T2, U2>)>

81

88 template <typename U1,

89 typename U2,

90 STDGPU_DETAIL_OVERLOAD_IF(std::is_constructible_v<T1, U1&>&& std::is_constructible_v<T2, U2&>)>

93

100 template <

101 typename U1,

102 typename U2,

103 STDGPU_DETAIL_OVERLOAD_IF(std::is_constructible_v<T1, const U1&>&& std::is_constructible_v<T2, const U2&>)>

106

113 template <class U1,

114 class U2,

115 STDGPU_DETAIL_OVERLOAD_IF(std::is_constructible_v<T1, U1>&& std::is_constructible_v<T2, U2>)>

118

125 template <class U1,

126 class U2,

127 STDGPU_DETAIL_OVERLOAD_IF(std::is_constructible_v<T1, U1>&& std::is_constructible_v<T2, U2>)>

130

136

141 pair(pair&& p) = default;

142

150

158 template <class U1,

159 class U2,

160 STDGPU_DETAIL_OVERLOAD_IF(std::is_assignable_v<T1&, const U1&>&& std::is_assignable_v<T2&, const U2&>)>

163

170 operator=(pair&& p) = default;

171

179 template <class U1,

180 class U2,

181 STDGPU_DETAIL_OVERLOAD_IF(std::is_assignable_v<T1&, U1>&& std::is_assignable_v<T2&, U2>)>

184

185

187

189};

190

198template

200forward(std::remove_reference_t& t) noexcept;

201

209template

211forward(std::remove_reference_t&& t) noexcept;

212

220template

223

224}

225

226#include <stdgpu/impl/utility_detail.h>

227

228#endif

#define STDGPU_HOST_DEVICE

Platform-independent host device function annotation.

Definition: platform.h:77

constexpr STDGPU_HOST_DEVICE std::remove_reference_t< T > && move(T &&t) noexcept

Moves a value.

constexpr STDGPU_HOST_DEVICE T && forward(std::remove_reference_t< T > &t) noexcept

Forwards a value.

constexpr STDGPU_HOST_DEVICE pair(const T1 &x, const T2 &y)

Constructor.

pair & operator=(const pair &p)=default

Default copy assignment operator.

first_type first

Definition: utility.h:186

pair(const pair &p)=default

Default copy constructor.

T2 second_type

Definition: utility.h:46

T1 first_type

Definition: utility.h:45

second_type second

Definition: utility.h:188

constexpr STDGPU_HOST_DEVICE pair(const pair< U1, U2 > &&p)

Move constructor.

constexpr STDGPU_HOST_DEVICE pair & operator=(pair< U1, U2 > &&p)

Move assignment operator.

constexpr STDGPU_HOST_DEVICE pair(pair< U1, U2 > &p)

Copy constructor.

constexpr STDGPU_HOST_DEVICE pair(U1 &&x, U2 &&y)

Constructor.

constexpr STDGPU_HOST_DEVICE pair(pair< U1, U2 > &&p)

Move constructor.

pair(pair &&p)=default

Default move constructor.

pair & operator=(pair &&p)=default

Default move assignment operator.

constexpr STDGPU_HOST_DEVICE pair(const pair< U1, U2 > &p)

Copy constructor.

constexpr STDGPU_HOST_DEVICE pair & operator=(const pair< U1, U2 > &p)

Copy assignment operator.

A pair of two values of potentially different types.

Definition: utility.h:44

~pair()=default

Default Destructor.

constexpr STDGPU_HOST_DEVICE pair()

Constructor.