Skip to content

Commit f267ff2

Browse files
committed
Remove workaround using boost::variant if std::variant not available
We are requiring C++17 now which has std::variant.
1 parent 40fd421 commit f267ff2

1 file changed

Lines changed: 3 additions & 37 deletions

File tree

include/osmium/util/string_matcher.hpp

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,9 @@ DEALINGS IN THE SOFTWARE.
3939
#include <regex>
4040
#include <string>
4141
#include <utility>
42+
#include <variant>
4243
#include <vector>
4344

44-
#ifdef __has_include
45-
# if __has_include(<variant>)
46-
# include <variant>
47-
# ifdef __cpp_lib_variant
48-
# define OSMIUM_USE_STD_VARIANT
49-
# endif
50-
# endif
51-
#endif
52-
53-
#ifndef OSMIUM_USE_STD_VARIANT
54-
# include <boost/variant.hpp>
55-
#endif
56-
5745
namespace osmium {
5846

5947
/**
@@ -257,11 +245,7 @@ namespace osmium {
257245
private:
258246

259247
using matcher_type =
260-
#ifdef OSMIUM_USE_STD_VARIANT
261248
std::variant
262-
#else
263-
boost::variant
264-
#endif
265249
<always_false,
266250
always_true,
267251
equal,
@@ -272,11 +256,7 @@ namespace osmium {
272256

273257
matcher_type m_matcher;
274258

275-
class match_visitor
276-
#ifndef OSMIUM_USE_STD_VARIANT
277-
: public boost::static_visitor<bool>
278-
#endif
279-
{
259+
class match_visitor {
280260

281261
const char* m_str;
282262

@@ -294,11 +274,7 @@ namespace osmium {
294274
}; // class match_visitor
295275

296276
template <typename TChar, typename TTraits>
297-
class print_visitor
298-
#ifndef OSMIUM_USE_STD_VARIANT
299-
: public boost::static_visitor<void>
300-
#endif
301-
{
277+
class print_visitor {
302278

303279
std::basic_ostream<TChar, TTraits>* m_out;
304280

@@ -399,11 +375,7 @@ namespace osmium {
399375
* Match the specified string.
400376
*/
401377
bool operator()(const char* str) const noexcept {
402-
#ifdef OSMIUM_USE_STD_VARIANT
403378
return std::visit(match_visitor{str}, m_matcher);
404-
#else
405-
return boost::apply_visitor(match_visitor{str}, m_matcher);
406-
#endif
407379
}
408380

409381
/**
@@ -415,11 +387,7 @@ namespace osmium {
415387

416388
template <typename TChar, typename TTraits>
417389
void print(std::basic_ostream<TChar, TTraits>& out) const {
418-
#ifdef OSMIUM_USE_STD_VARIANT
419390
std::visit(print_visitor<TChar, TTraits>{out}, m_matcher);
420-
#else
421-
boost::apply_visitor(print_visitor<TChar, TTraits>{out}, m_matcher);
422-
#endif
423391
}
424392

425393
}; // class StringMatcher
@@ -432,6 +400,4 @@ namespace osmium {
432400

433401
} // namespace osmium
434402

435-
#undef OSMIUM_USE_STD_VARIANT
436-
437403
#endif // OSMIUM_UTIL_STRING_MATCHER_HPP

0 commit comments

Comments
 (0)