Diag-Client-Lib
variant_helper.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8 #ifndef DIAG_CLIENT_LIB_LIB_PLATFORM_CORE_VARIANT_HELPER_H_
9 #define DIAG_CLIENT_LIB_LIB_PLATFORM_CORE_VARIANT_HELPER_H_
10 
11 namespace core_type {
12 namespace visit {
13 
14 // helper type for the visitor pattern in std::visit
15 template<class... Ts>
16 struct overloaded : Ts... {
17  using Ts::operator()...;
18 };
19 
20 // explicit deduction guide (not needed as of C++20)
21 template<class... Ts>
22 overloaded(Ts...) -> overloaded<Ts...>;
23 
24 } // namespace visit
25 } // namespace core_type
26 
27 #endif // DIAG_CLIENT_LIB_LIB_PLATFORM_CORE_VARIANT_HELPER_H_
overloaded(Ts...) -> overloaded< Ts... >