1 /* 2 * Copyright 2018 NVIDIA Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /*! \file void_t.h 18 * \brief C++17's `void_t`. 19 */ 20 21 #pragma once 22 23 #include <thrust/detail/config.h> 24 25 #if THRUST_CPP_DIALECT >= 2017 26 # include <type_traits> 27 #endif 28 29 THRUST_BEGIN_NS 30 31 #if THRUST_CPP_DIALECT >= 2011 32 33 template <typename...> struct voider { using type = void; }; 34 35 #if THRUST_CPP_DIALECT >= 2017 36 using std::void_t; 37 #else 38 template <typename... Ts> using void_t = typename voider<Ts...>::type; 39 #endif 40 41 #else // Older than C++11. 42 43 template < 44 typename = void 45 , typename = void 46 , typename = void 47 , typename = void 48 , typename = void 49 , typename = void 50 , typename = void 51 , typename = void 52 , typename = void 53 , typename = void 54 > 55 struct voider 56 { 57 typedef void type; 58 }; 59 60 #endif 61 62 THRUST_END_NS 63 64