15 #ifndef OPENSCENARIO_INTERPRETER__VARIANT__VISIBILITY_H_
16 #define OPENSCENARIO_INTERPRETER__VARIANT__VISIBILITY_H_
18 #if __cplusplus >= 201606
21 #include <boost/variant.hpp>
26 #if __cplusplus >= 201606
28 template <
typename... Ts>
29 using Variant = std::variant<Ts...>;
35 template <
typename... Ts>
38 template <
typename Lambda,
typename... Ts>
40 : boost::static_visitor<
41 typename std::common_type<decltype(std::declval<Lambda>()(std::declval<Ts>()))...>::type>
49 return visitor(std::forward<T>(arg));
55 return visitor(std::forward<T>(arg));
62 template <
typename Visitor,
typename... Ts>
63 auto visit(Visitor && visitor,
const boost::variant<Ts...> & arg0)
66 return boost::apply_visitor(f, arg0);
69 template <
typename Visitor,
typename... Ts>
70 auto visit(Visitor && visitor, boost::variant<Ts...> && arg0)
73 return boost::apply_visitor(f, std::move(arg0));
76 template <
typename Visitor,
typename... Ts,
typename... Variants>
77 auto visit(Visitor && visitor,
const boost::variant<Ts...> & var0, Variants &&... vars)
80 [&visitor, &vars...](
auto && arg0) {
82 [&visitor, &arg0](auto &&... args) {
83 return visitor(arg0, std::forward<decltype(args)>(args)...);
85 std::forward<decltype(vars)>(vars)...);
90 template <
typename Visitor,
typename... Ts,
typename... Variants>
91 auto visit(Visitor && visitor, boost::variant<Ts...> && var0, Variants &&... vars)
94 [&visitor, &vars...](
auto && arg0) {
96 [&visitor, &arg0](auto &&... args) {
97 return visitor(arg0, std::forward<decltype(args)>(args)...);
99 std::forward<decltype(vars)>(vars)...);
Definition: escape_sequence.hpp:22
auto visit(Visitor &&visitor, const boost::variant< Ts... > &arg0)
Definition: variant.hpp:63
auto visit(Visitor &&visitor, boost::variant< Ts... > &&var0, Variants &&... vars)
Definition: variant.hpp:91
boost::variant< Ts... > Variant
Definition: variant.hpp:36
Definition: variant.hpp:42
auto operator()(T &&arg) const
Definition: variant.hpp:53
lambda_visitor(const Lambda &visitor)
Definition: variant.hpp:43
auto operator()(T &&arg)
Definition: variant.hpp:47
lambda_visitor(Lambda &&visitor)
Definition: variant.hpp:44