@@ -323,7 +323,7 @@ class variant {
323
323
*/
324
324
325
325
// Implementation details for apply_visitor
326
- private:
326
+ // private:
327
327
using dispatcher_t = detail::visitor_dispatch<detail::false_, 1 + sizeof ...(Types)>;
328
328
329
329
#define APPLY_VISITOR_IMPL_BODY \
@@ -335,13 +335,14 @@ class variant {
335
335
static auto apply_visitor_impl (Visitor && visitor,
336
336
Visitable && visitable) noexcept (noexcept (APPLY_VISITOR_IMPL_BODY))
337
337
-> decltype(APPLY_VISITOR_IMPL_BODY) {
338
- static_assert (std::is_same<const variant, const mpl::remove_reference_t <Visitable>>::value, " Misuse of apply_visitor_impl!" );
338
+ static_assert (std::is_same<const variant, const mpl::remove_reference_t <Visitable>>::value,
339
+ " Misuse of apply_visitor_impl!" );
339
340
return APPLY_VISITOR_IMPL_BODY;
340
341
}
341
342
342
343
#undef APPLY_VISITOR_IMPL_BODY
343
344
344
- public:
345
+ // public:
345
346
// C++17 visit syntax
346
347
template <typename V>
347
348
auto visit (V && v)
@@ -364,27 +365,18 @@ class variant {
364
365
-> decltype(apply_visitor_impl(std::forward<V>(v), std::move(*this ))) {
365
366
return apply_visitor_impl (std::forward<V>(v), std::move (*this ));
366
367
}
367
-
368
- // Friend apply_visitor (boost::apply_visitor syntax)
369
-
370
- #define APPLY_VISITOR_BODY \
371
- mpl::remove_reference_t <Visitable>::apply_visitor_impl(std::forward<Visitor>(visitor), \
372
- std::forward<Visitable>(visitable))
373
-
374
- // TODO: Why doesn't noexcept annotation work here? It causes ICE in gcc and clang
375
- template <typename Visitor, typename Visitable>
376
- friend auto apply_visitor(Visitor && visitor,
377
- Visitable && visitable) /* noexcept(noexcept(APPLY_VISITOR_BODY)) */
378
- -> decltype(APPLY_VISITOR_BODY);
379
368
};
380
369
381
370
/* **
382
- * apply one visitor function. This is the basic version, used in implementation
383
- * of multivisitation.
371
+ * apply one visitor function. `boost::variant` syntax.
372
+ * This is the basic version, used in implementation of multivisitation.
384
373
*/
374
+ #define APPLY_VISITOR_BODY \
375
+ mpl::remove_reference_t <Visitable>::apply_visitor_impl(std::forward<Visitor>(visitor), \
376
+ std::forward<Visitable>(visitable))
385
377
template <typename Visitor, typename Visitable>
386
378
auto
387
- apply_visitor (Visitor && visitor, Visitable && visitable) /* noexcept(noexcept(APPLY_VISITOR_BODY))*/
379
+ apply_visitor(Visitor && visitor, Visitable && visitable) noexcept (noexcept (APPLY_VISITOR_BODY))
388
380
-> decltype(APPLY_VISITOR_BODY) {
389
381
return APPLY_VISITOR_BODY;
390
382
}
0 commit comments