mqtt_cpp
optional.hpp
Go to the documentation of this file.
1 // Copyright Takatoshi Kondo 2018
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_OPTIONAL_HPP)
8 #define MQTT_OPTIONAL_HPP
9 
10 #if defined(MQTT_STD_OPTIONAL)
11 
12 #include <optional>
13 
14 #else // defined(MQTT_STD_OPTIONAL)
15 
16 #include <boost/optional.hpp>
17 
18 #endif // defined(MQTT_STD_VARIANT)
19 
20 #include <mqtt/namespace.hpp>
21 
22 namespace MQTT_NS {
23 
24 #if defined(MQTT_STD_OPTIONAL)
25 
26 using std::optional;
27 using std::nullopt_t;
28 using in_place_t = std::in_place_t;
29 static constexpr auto in_place_init = in_place_t{};
30 static constexpr auto nullopt = std::nullopt;
31 
32 #else // defined(MQTT_STD_OPTIONAL)
33 
34 using boost::optional;
35 using nullopt_t = boost::none_t;
36 using boost::in_place_init;
37 static const auto nullopt = boost::none;
38 
39 #endif // defined(MQTT_STD_OPTIONAL)
40 
41 } // namespace MQTT_NS
42 
43 #endif // MQTT_OPTIONAL_HPP
Definition: any.hpp:27
boost::none_t nullopt_t
Definition: optional.hpp:35