@@ -258,6 +258,7 @@ struct unwrapper<std::reference_wrapper<T>>
258
258
{
259
259
return obj.get ();
260
260
}
261
+
261
262
};
262
263
263
264
@@ -268,7 +269,7 @@ template <typename F, typename V, typename R, typename T, typename...Types>
268
269
struct dispatcher <F, V, R, T, Types...>
269
270
{
270
271
using result_type = R;
271
- VARIANT_INLINE static result_type apply_const (V const & v, F const & f)
272
+ VARIANT_INLINE static result_type apply_const (V const & v, F f)
272
273
{
273
274
if (v.get_type_index () == sizeof ...(Types))
274
275
{
@@ -280,7 +281,7 @@ struct dispatcher<F, V, R, T, Types...>
280
281
}
281
282
}
282
283
283
- VARIANT_INLINE static result_type apply (V & v, F & f)
284
+ VARIANT_INLINE static result_type apply (V & v, F f)
284
285
{
285
286
if (v.get_type_index () == sizeof ...(Types))
286
287
{
@@ -297,12 +298,12 @@ template<typename F, typename V, typename R>
297
298
struct dispatcher <F, V, R>
298
299
{
299
300
using result_type = R;
300
- VARIANT_INLINE static result_type apply_const (V const &, F const & f )
301
+ VARIANT_INLINE static result_type apply_const (V const &, F)
301
302
{
302
303
throw std::runtime_error (std::string (" unary dispatch: FAIL " ) + typeid (V).name ());
303
304
}
304
305
305
- VARIANT_INLINE static result_type apply (V &, F & f )
306
+ VARIANT_INLINE static result_type apply (V &, F)
306
307
{
307
308
throw std::runtime_error (std::string (" unary dispatch: FAIL " ) + typeid (V).name ());
308
309
}
@@ -316,7 +317,7 @@ template <typename F, typename V, typename R, typename T0, typename T1, typename
316
317
struct binary_dispatcher_rhs <F, V, R, T0, T1, Types...>
317
318
{
318
319
using result_type = R;
319
- VARIANT_INLINE static result_type apply_const (V const & lhs, V const & rhs, F const & f)
320
+ VARIANT_INLINE static result_type apply_const (V const & lhs, V const & rhs, F f)
320
321
{
321
322
if (rhs.get_type_index () == sizeof ...(Types)) // call binary functor
322
323
{
@@ -329,7 +330,7 @@ struct binary_dispatcher_rhs<F, V, R, T0, T1, Types...>
329
330
}
330
331
}
331
332
332
- VARIANT_INLINE static result_type apply (V & lhs, V & rhs, F & f)
333
+ VARIANT_INLINE static result_type apply (V & lhs, V & rhs, F f)
333
334
{
334
335
if (rhs.get_type_index () == sizeof ...(Types)) // call binary functor
335
336
{
@@ -348,11 +349,11 @@ template<typename F, typename V, typename R, typename T>
348
349
struct binary_dispatcher_rhs <F, V, R, T>
349
350
{
350
351
using result_type = R;
351
- VARIANT_INLINE static result_type apply_const (V const &, V const &, F const & )
352
+ VARIANT_INLINE static result_type apply_const (V const &, V const &, F)
352
353
{
353
354
throw std::runtime_error (" binary dispatch: FAIL" );
354
355
}
355
- VARIANT_INLINE static result_type apply (V &, V &, F & )
356
+ VARIANT_INLINE static result_type apply (V &, V &, F)
356
357
{
357
358
throw std::runtime_error (" binary dispatch: FAIL" );
358
359
}
@@ -366,7 +367,7 @@ template <typename F, typename V, typename R, typename T0, typename T1, typename
366
367
struct binary_dispatcher_lhs <F, V, R, T0, T1, Types...>
367
368
{
368
369
using result_type = R;
369
- VARIANT_INLINE static result_type apply_const (V const & lhs, V const & rhs, F const & f)
370
+ VARIANT_INLINE static result_type apply_const (V const & lhs, V const & rhs, F f)
370
371
{
371
372
if (lhs.get_type_index () == sizeof ...(Types)) // call binary functor
372
373
{
@@ -378,7 +379,7 @@ struct binary_dispatcher_lhs<F, V, R, T0, T1, Types...>
378
379
}
379
380
}
380
381
381
- VARIANT_INLINE static result_type apply (V & lhs, V & rhs, F & f)
382
+ VARIANT_INLINE static result_type apply (V & lhs, V & rhs, F f)
382
383
{
383
384
if (lhs.get_type_index () == sizeof ...(Types)) // call binary functor
384
385
{
@@ -396,12 +397,12 @@ template<typename F, typename V, typename R, typename T>
396
397
struct binary_dispatcher_lhs <F, V, R, T>
397
398
{
398
399
using result_type = R;
399
- VARIANT_INLINE static result_type apply_const (V const &, V const &, F const & )
400
+ VARIANT_INLINE static result_type apply_const (V const &, V const &, F)
400
401
{
401
402
throw std::runtime_error (" binary dispatch: FAIL" );
402
403
}
403
404
404
- VARIANT_INLINE static result_type apply (V &, V &, F & )
405
+ VARIANT_INLINE static result_type apply (V &, V &, F)
405
406
{
406
407
throw std::runtime_error (" binary dispatch: FAIL" );
407
408
}
@@ -414,7 +415,7 @@ template <typename F, typename V, typename R, typename T, typename...Types>
414
415
struct binary_dispatcher <F, V, R, T, Types...>
415
416
{
416
417
using result_type = R;
417
- VARIANT_INLINE static result_type apply_const (V const & v0, V const & v1, F const & f)
418
+ VARIANT_INLINE static result_type apply_const (V const & v0, V const & v1, F f)
418
419
{
419
420
if (v0.get_type_index () == sizeof ...(Types))
420
421
{
@@ -434,7 +435,7 @@ struct binary_dispatcher<F, V, R, T, Types...>
434
435
return binary_dispatcher<F, V, R, Types...>::apply_const (v0, v1, f);
435
436
}
436
437
437
- VARIANT_INLINE static result_type apply (V & v0, V & v1, F & f)
438
+ VARIANT_INLINE static result_type apply (V & v0, V & v1, F f)
438
439
{
439
440
if (v0.get_type_index () == sizeof ...(Types))
440
441
{
@@ -459,12 +460,12 @@ template<typename F, typename V, typename R>
459
460
struct binary_dispatcher <F, V, R>
460
461
{
461
462
using result_type = R;
462
- VARIANT_INLINE static result_type apply_const (V const &, V const &, F const & )
463
+ VARIANT_INLINE static result_type apply_const (V const &, V const &, F)
463
464
{
464
465
throw std::runtime_error (" binary dispatch: FAIL" );
465
466
}
466
467
467
- VARIANT_INLINE static result_type apply (V &, V &, F & )
468
+ VARIANT_INLINE static result_type apply (V &, V &, F)
468
469
{
469
470
throw std::runtime_error (" binary dispatch: FAIL" );
470
471
}
@@ -716,7 +717,7 @@ class variant
716
717
// unary
717
718
template <typename F, typename V>
718
719
auto VARIANT_INLINE
719
- static visit (V const & v, F & f)
720
+ static visit (V const & v, F f)
720
721
-> decltype(detail::dispatcher<F, V,
721
722
typename detail::result_of_unary_visit<F,
722
723
typename detail::select_type<0 , Types...>::type>::type, Types...>::apply_const(v, f))
@@ -727,7 +728,7 @@ class variant
727
728
// non-const
728
729
template <typename F, typename V>
729
730
auto VARIANT_INLINE
730
- static visit (V & v, F & f)
731
+ static visit (V & v, F f)
731
732
-> decltype(detail::dispatcher<F, V,
732
733
typename detail::result_of_unary_visit<F,
733
734
typename detail::select_type<0 , Types...>::type>::type, Types...>::apply(v, f))
@@ -740,7 +741,7 @@ class variant
740
741
// const
741
742
template <typename F, typename V>
742
743
auto VARIANT_INLINE
743
- static binary_visit (V const & v0, V const & v1, F & f)
744
+ static binary_visit (V const & v0, V const & v1, F f)
744
745
-> decltype(detail::binary_dispatcher<F, V,
745
746
typename detail::result_of_binary_visit<F,
746
747
typename detail::select_type<0 , Types...>::type>::type, Types...>::apply_const(v0, v1, f))
@@ -751,7 +752,7 @@ class variant
751
752
// non-const
752
753
template <typename F, typename V>
753
754
auto VARIANT_INLINE
754
- static binary_visit (V& v0, V& v1, F & f)
755
+ static binary_visit (V& v0, V& v1, F f)
755
756
-> decltype(detail::binary_dispatcher<F, V,
756
757
typename detail::result_of_binary_visit<F,
757
758
typename detail::select_type<0 , Types...>::type>::type, Types...>::apply(v0, v1, f))
@@ -791,27 +792,27 @@ class variant
791
792
792
793
// const
793
794
template <typename V, typename F>
794
- auto VARIANT_INLINE static apply_visitor (F const & f, V const & v) -> decltype(V::visit(v, f))
795
+ auto VARIANT_INLINE static apply_visitor (F f, V const & v) -> decltype(V::visit(v, f))
795
796
{
796
797
return V::visit (v, f);
797
798
}
798
799
// non-const
799
800
template <typename V, typename F>
800
- auto VARIANT_INLINE static apply_visitor (F & f, V & v) -> decltype(V::visit(v, f))
801
+ auto VARIANT_INLINE static apply_visitor (F f, V & v) -> decltype(V::visit(v, f))
801
802
{
802
803
return V::visit (v, f);
803
804
}
804
805
805
806
// binary visitor interface
806
807
// const
807
808
template <typename V, typename F>
808
- auto VARIANT_INLINE static apply_visitor (F const & f, V const & v0, V const & v1) -> decltype(V::binary_visit(v0, v1, f))
809
+ auto VARIANT_INLINE static apply_visitor (F f, V const & v0, V const & v1) -> decltype(V::binary_visit(v0, v1, f))
809
810
{
810
811
return V::binary_visit (v0, v1, f);
811
812
}
812
813
// non-const
813
814
template <typename V, typename F>
814
- auto VARIANT_INLINE static apply_visitor (F & f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, f))
815
+ auto VARIANT_INLINE static apply_visitor (F f, V & v0, V & v1) -> decltype(V::binary_visit(v0, v1, f))
815
816
{
816
817
return V::binary_visit (v0, v1, f);
817
818
}
0 commit comments