Skip to content

Commit 9b94aa7

Browse files
committed
Fix detection of std::variant availability
1 parent 97c6c28 commit 9b94aa7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

include/osmium/util/string_matcher.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ DEALINGS IN THE SOFTWARE.
4444
#ifdef __has_include
4545
# if __has_include(<variant>)
4646
# include <variant>
47-
# define OSMIUM_USE_STD_VARIANT
47+
# ifdef __cpp_lib_variant
48+
# define OSMIUM_USE_STD_VARIANT
49+
# endif
4850
# endif
49-
#else
51+
#endif
52+
53+
#ifndef OSMIUM_USE_STD_VARIANT
5054
# include <boost/variant.hpp>
51-
# define OSMIUM_USE_BOOST_VARIANT
5255
#endif
5356

5457

@@ -298,7 +301,7 @@ namespace osmium {
298301
matcher_type m_matcher;
299302

300303
class match_visitor
301-
#ifdef OSMIUM_USE_BOOST_VARIANT
304+
#ifndef OSMIUM_USE_STD_VARIANT
302305
: public boost::static_visitor<bool>
303306
#endif
304307
{
@@ -320,7 +323,7 @@ namespace osmium {
320323

321324
template <typename TChar, typename TTraits>
322325
class print_visitor
323-
#ifdef OSMIUM_USE_BOOST_VARIANT
326+
#ifndef OSMIUM_USE_STD_VARIANT
324327
: public boost::static_visitor<void>
325328
#endif
326329
{
@@ -460,6 +463,5 @@ namespace osmium {
460463
} // namespace osmium
461464

462465
#undef OSMIUM_USE_STD_VARIANT
463-
#undef OSMIUM_USE_BOOST_VARIANT
464466

465467
#endif // OSMIUM_UTIL_STRING_MATCHER_HPP

0 commit comments

Comments
 (0)