@@ -445,6 +445,12 @@ namespace detail
445
445
DelegatePImpl::fn = fn;
446
446
}
447
447
448
+ template <typename F> DelegatePImpl (const F& fn)
449
+ {
450
+ kind = FP;
451
+ DelegatePImpl::fn = fn;
452
+ }
453
+
448
454
DelegatePImpl& operator =(const DelegatePImpl& del)
449
455
{
450
456
if (this == &del) return *this ;
@@ -502,6 +508,17 @@ namespace detail
502
508
return *this ;
503
509
}
504
510
511
+ template <typename F> DelegatePImpl& operator =(const F& fn)
512
+ {
513
+ if (FPA == kind)
514
+ {
515
+ obj = {};
516
+ }
517
+ kind = FP;
518
+ this ->fn = fn;
519
+ return *this ;
520
+ }
521
+
505
522
DelegatePImpl& IRAM_ATTR operator =(std::nullptr_t )
506
523
{
507
524
if (FPA == kind)
@@ -694,6 +711,17 @@ namespace detail
694
711
return *this ;
695
712
}
696
713
714
+ DelegatePImpl& operator =(FunPtr fn)
715
+ {
716
+ if (FUNC == kind)
717
+ {
718
+ functional.~FunctionType ();
719
+ kind = FP;
720
+ }
721
+ DelegatePImpl::fn = fn;
722
+ return *this ;
723
+ }
724
+
697
725
template <typename F> DelegatePImpl& operator =(const F& functional)
698
726
{
699
727
if (FUNC != kind)
@@ -716,17 +744,6 @@ namespace detail
716
744
return *this ;
717
745
}
718
746
719
- DelegatePImpl& operator =(FunPtr fn)
720
- {
721
- if (FUNC == kind)
722
- {
723
- functional.~FunctionType ();
724
- kind = FP;
725
- }
726
- DelegatePImpl::fn = fn;
727
- return *this ;
728
- }
729
-
730
747
DelegatePImpl& IRAM_ATTR operator =(std::nullptr_t )
731
748
{
732
749
if (FUNC == kind)
@@ -842,6 +859,11 @@ namespace detail
842
859
DelegatePImpl::fn = fn;
843
860
}
844
861
862
+ template <typename F> DelegatePImpl (const F& fn)
863
+ {
864
+ DelegatePImpl::fn = fn;
865
+ }
866
+
845
867
DelegatePImpl& operator =(const DelegatePImpl& del)
846
868
{
847
869
if (this == &del) return *this ;
@@ -862,6 +884,12 @@ namespace detail
862
884
return *this ;
863
885
}
864
886
887
+ template <typename F> DelegatePImpl& operator =(const F& fn)
888
+ {
889
+ DelegatePImpl::fn = fn;
890
+ return *this ;
891
+ }
892
+
865
893
DelegatePImpl& IRAM_ATTR operator =(std::nullptr_t )
866
894
{
867
895
fn = nullptr ;
@@ -1292,6 +1320,12 @@ namespace detail
1292
1320
DelegateImpl::fn = fn;
1293
1321
}
1294
1322
1323
+ template <typename F> DelegateImpl (const F& fn)
1324
+ {
1325
+ kind = FP;
1326
+ DelegateImpl::fn = fn;
1327
+ }
1328
+
1295
1329
DelegateImpl& operator =(const DelegateImpl& del)
1296
1330
{
1297
1331
if (this == &del) return *this ;
@@ -1349,6 +1383,17 @@ namespace detail
1349
1383
return *this ;
1350
1384
}
1351
1385
1386
+ template <typename F> DelegateImpl& operator =(const F& fn)
1387
+ {
1388
+ if (FPA == kind)
1389
+ {
1390
+ obj = {};
1391
+ }
1392
+ kind = FP;
1393
+ this ->fn = fn;
1394
+ return *this ;
1395
+ }
1396
+
1352
1397
DelegateImpl& IRAM_ATTR operator =(std::nullptr_t )
1353
1398
{
1354
1399
if (FPA == kind)
@@ -1540,6 +1585,17 @@ namespace detail
1540
1585
return *this ;
1541
1586
}
1542
1587
1588
+ DelegateImpl& operator =(FunPtr fn)
1589
+ {
1590
+ if (FUNC == kind)
1591
+ {
1592
+ functional.~FunctionType ();
1593
+ kind = FP;
1594
+ }
1595
+ DelegateImpl::fn = fn;
1596
+ return *this ;
1597
+ }
1598
+
1543
1599
template <typename F> DelegateImpl& operator =(const F& functional)
1544
1600
{
1545
1601
if (FUNC != kind)
@@ -1562,17 +1618,6 @@ namespace detail
1562
1618
return *this ;
1563
1619
}
1564
1620
1565
- DelegateImpl& operator =(FunPtr fn)
1566
- {
1567
- if (FUNC == kind)
1568
- {
1569
- functional.~FunctionType ();
1570
- kind = FP;
1571
- }
1572
- DelegateImpl::fn = fn;
1573
- return *this ;
1574
- }
1575
-
1576
1621
DelegateImpl& IRAM_ATTR operator =(std::nullptr_t )
1577
1622
{
1578
1623
if (FUNC == kind)
@@ -1688,6 +1733,11 @@ namespace detail
1688
1733
DelegateImpl::fn = fn;
1689
1734
}
1690
1735
1736
+ template <typename F> DelegateImpl (const F& fn)
1737
+ {
1738
+ DelegateImpl::fn = fn;
1739
+ }
1740
+
1691
1741
DelegateImpl& operator =(const DelegateImpl& del)
1692
1742
{
1693
1743
if (this == &del) return *this ;
@@ -1708,6 +1758,12 @@ namespace detail
1708
1758
return *this ;
1709
1759
}
1710
1760
1761
+ template <typename F> DelegateImpl& operator =(const F& fn)
1762
+ {
1763
+ DelegateImpl::fn = fn;
1764
+ return *this ;
1765
+ }
1766
+
1711
1767
DelegateImpl& IRAM_ATTR operator =(std::nullptr_t )
1712
1768
{
1713
1769
fn = nullptr ;
0 commit comments