Skip to content

Commit d212b10

Browse files
committed
Add helper: openPMD::auxiliary::overloaded
1 parent 3acf565 commit d212b10

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/openPMD/auxiliary/Variant.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,17 @@ namespace auxiliary
9090
private:
9191
resource m_data;
9292
};
93+
94+
/*
95+
* Helper type for std::visit,
96+
* see https://en.cppreference.com/w/cpp/utility/variant/visit
97+
*/
98+
template <class... Ts>
99+
struct overloaded : Ts...
100+
{
101+
using Ts::operator()...;
102+
};
103+
template <class... Ts>
104+
overloaded(Ts...) -> overloaded<Ts...>;
93105
} // namespace auxiliary
94106
} // namespace openPMD

0 commit comments

Comments
 (0)