stdgpu/utility.h Source File

stdgpu/utility.h Source File#

stdgpu: stdgpu/utility.h Source File
stdgpu Latest
Efficient STL-like Data Structures on the GPU
utility.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 Patrick Stotko
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef STDGPU_UTILITY_H
17#define STDGPU_UTILITY_H
18
28#include <thrust/pair.h>
29#include <type_traits>
30
31#include <stdgpu/platform.h>
32
33namespace stdgpu
34{
35
42template <typename T1, typename T2>
43using pair = thrust::pair<T1, T2>;
44
52template <class T>
53constexpr STDGPU_HOST_DEVICE T&&
54forward(std::remove_reference_t<T>& t) noexcept;
55
63template <class T>
64constexpr STDGPU_HOST_DEVICE T&&
65forward(std::remove_reference_t<T>&& t) noexcept;
66
74template <class T>
75constexpr STDGPU_HOST_DEVICE std::remove_reference_t<T>&&
76move(T&& t) noexcept;
77
78} // namespace stdgpu
79
80#include <stdgpu/impl/utility_detail.h>
81
82#endif // STDGPU_UTILITY_H
#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.
thrust::pair< T1, T2 > pair
A pair of two values of potentially different types.
Definition: utility.h:43
constexpr STDGPU_HOST_DEVICE T && forward(std::remove_reference_t< T > &t) noexcept
Forwards a value.