Brian Silverman | 4a2409e | 2018-08-04 23:24:02 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2017 Glen Joseph Fernandes |
| 3 | <glenjofe -at- gmail.com> |
| 4 | |
| 5 | Distributed under the Boost Software License, |
| 6 | Version 1.0. (See accompanying file LICENSE_1_0.txt |
| 7 | or copy at http://www.boost.org/LICENSE_1_0.txt). |
| 8 | ] |
| 9 | |
| 10 | [section:make_void make_void] |
| 11 | |
| 12 | template<class...> |
| 13 | struct make_void |
| 14 | { |
| 15 | typedef void type; |
| 16 | }; |
| 17 | |
| 18 | template<class... Ts> |
| 19 | using void_t = typename make_void<Ts...>::type; |
| 20 | |
| 21 | __type The type `void` for all `T`. |
| 22 | |
| 23 | __header ` #include <boost/type_traits/make_void.hpp>` or ` #include <boost/type_traits.hpp>` |
| 24 | |
| 25 | [table Examples |
| 26 | |
| 27 | [[Expression] [Result Type]] |
| 28 | |
| 29 | [[`make_void<int>::type`][`void`]] |
| 30 | |
| 31 | [[`make_void<int&>::type`] [`void`]] |
| 32 | |
| 33 | [[`make_void<int(*)(int)>::type`] [`void`]] |
| 34 | |
| 35 | [[`make_void<int[]>::type`] [`void`]] |
| 36 | |
| 37 | [[`make_void<int[1]>::type`] [`void`]] |
| 38 | |
| 39 | [[`make_void<>::type`] [`void`]] |
| 40 | |
| 41 | [[`make_void<int, int>::type`] [`void`]] |
| 42 | |
| 43 | ] |
| 44 | |
| 45 | [all_compilers] However, the type alias `void_t` is only available if the compiler supports template aliases. |
| 46 | Further, in the absence of variadic-template support, `make_void` only supports up to 5 parameters. |
| 47 | |
| 48 | [endsect] |