mqtt_cpp
variant_visit.hpp
Go to the documentation of this file.
1 // Copyright Takatoshi Kondo 2020
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #if !defined(MQTT_VARIANT_VISIT_HPP)
8 #define MQTT_VARIANT_VISIT_HPP
9 
10 #include <ostream>
11 
12 #include <mqtt/namespace.hpp>
13 #include <mqtt/variant.hpp>
14 #include <mqtt/visitor_util.hpp>
15 
16 namespace MQTT_NS {
17 
18 #if defined(MQTT_STD_VARIANT)
19 
20 template<typename... Params>
21 std::ostream& operator<<(std::ostream& os, variant<Params...> const& v) {
24  [&os] (auto const& e) {
25  os << e;
26  }
27  ), v
28  );
29  return os;
30 }
31 
32 #endif // defined(MQTT_USE_STD_VARIANT)
33 
34 } // namespace MQTT_NS
35 
36 #endif // MQTT_VARIANT_VISIT_HPP
Definition: any.hpp:27
constexpr decltype(auto) visit(Visitor &&vis, Variants &&... vars)
Definition: variant.hpp:60
std::ostream & operator<<(std::ostream &os, connect_return_code val)
Definition: connect_return_code.hpp:43
lambda_visitor< Lambdas... > make_lambda_visitor(Lambdas &&... lambdas)
Definition: visitor_util.hpp:37