73 template <
typename Func>
77 std::forward<Func>(
func),
86 template <
typename Func>
90 std::forward<Func>(
func),
99 template <
typename Func>
103 std::forward<Func>(
func),
112 template <
typename T>
114 return std::get<T>(var_);
121 template <
typename T>
122 decltype(
auto)
get()
const {
123 return std::get<T>(var_);
130 template <
typename T>
132 return std::get_if<T>(&var_);
139 template <
typename T>
141 return std::get_if<T>(&var_);
170 return p.const_buffer_sequence();
173 return std::vector<as::const_buffer>{};
179 operator bool()
const {
180 return var_.index() != 0;
184 using variant_t = variant<
186 v3_1_1::connect_packet,
187 v3_1_1::connack_packet,
188 v3_1_1::basic_publish_packet<PacketIdBytes>,
189 v3_1_1::basic_puback_packet<PacketIdBytes>,
190 v3_1_1::basic_pubrec_packet<PacketIdBytes>,
191 v3_1_1::basic_pubrel_packet<PacketIdBytes>,
192 v3_1_1::basic_pubcomp_packet<PacketIdBytes>,
193 v3_1_1::basic_subscribe_packet<PacketIdBytes>,
194 v3_1_1::basic_suback_packet<PacketIdBytes>,
195 v3_1_1::basic_unsubscribe_packet<PacketIdBytes>,
196 v3_1_1::basic_unsuback_packet<PacketIdBytes>,
197 v3_1_1::pingreq_packet,
198 v3_1_1::pingresp_packet,
199 v3_1_1::disconnect_packet,
202 v5::basic_publish_packet<PacketIdBytes>,
203 v5::basic_puback_packet<PacketIdBytes>,
204 v5::basic_pubrec_packet<PacketIdBytes>,
205 v5::basic_pubrel_packet<PacketIdBytes>,
206 v5::basic_pubcomp_packet<PacketIdBytes>,
207 v5::basic_subscribe_packet<PacketIdBytes>,
208 v5::basic_suback_packet<PacketIdBytes>,
209 v5::basic_unsubscribe_packet<PacketIdBytes>,
210 v5::basic_unsuback_packet<PacketIdBytes>,
213 v5::disconnect_packet,
decltype(auto) get() const
Get by type. If not match, then throw std::bad_variant_access exception.
Definition packet_variant.hpp:122