8000 Revert "Add assignment operators." · dok-net/arduino-esp8266@6b6dbee · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b6dbee

Browse files
committed
Revert "Add assignment operators."
This reverts commit 7c9c23e.
1 parent 4fa0dbb commit 6b6dbee

File tree

1 file changed

+18
-144
lines changed

1 file changed

+18
-144
lines changed

cores/esp8266/Delegate.h

Lines changed: 18 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -239,21 +239,6 @@ namespace delegate
239239
return *this;
240240
}
241241

242-
template<typename F> DelegatePImpl& operator=(F functional)
243-
{
244-
if (FUNC == kind)
245-
{
246-
this->functional.~FunctionType();
247-
}
248-
else if (FPA == kind)
249-
{
250-
obj.~A();
251-
}
252-
kind = FUNC;
253-
new (&this->functional) FunctionType(std::forward<F>(functional));
254-
return *this;
255-
}
256-
257242
DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
258243
{
259244
if (FUNC == kind)
@@ -436,10 +421,10 @@ namespace delegate
436421
DelegatePImpl::fn = fn;
437422
}
438423

439-
template<typename F> DelegatePImpl(F functional)
424+
template<typename F> DelegatePImpl(F fn)
440425
{
441426
kind = FP;
442-
fn = std::forward<F>(functional);
427+
DelegatePImpl::fn = std::forward<F>(fn);
443428
}
444429

445430
DelegatePImpl& operator=(const DelegatePImpl& del)
@@ -499,16 +484,6 @@ namespace delegate
499484
return *this;
500485
}
501486

502-
template<typename F> DelegatePImpl& operator=(F functional)
503-
{
504-
if (FPA == kind)
505-
{
506-
obj = {};
507-
}
508-
kind = FP;
509-
fn = std::forward<F>(functional);
510-
}
511-
512487
DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
513488
{
514489
if (FPA == kind)
@@ -708,17 +683,6 @@ namespace delegate
708683
return *this;
709684
}
710685

711-
template<typename F> DelegatePImpl& operator=(F functional)
712-
{
713-
if (FUNC == kind)
714-
{
715-
this->functional.~FunctionType();
716-
}
717-
kind = FUNC;
718-
new (&this->functional) FunctionType(std::forward<F>(functional));
719-
return *this;
720-
}
721-
722686
DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
723687
{
724688
if (FUNC == kind)
@@ -859,12 +823,6 @@ namespace delegate
859823
return *this;
860824
}
861825

862-
template<typename F> DelegatePImpl& operator=(F functional)
863-
{
864-
fn = std::forward<F>(functional);
865-
return *this;
866-
}
867-
868826
DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
869827
{
870828
fn = nullptr;
@@ -1082,21 +1040,6 @@ namespace delegate
10821040
return *this;
10831041
}
10841042

1085-
template<typename F> DelegateImpl& operator=(F functional)
1086-
{
1087-
if (FUNC == kind)
1088-
{
1089-
this->functional.~FunctionType();
1090-
}
1091-
else if (FPA == kind)
1092-
{
1093-
obj.~A();
1094-
}
1095-
kind = FUNC;
1096-
new (&this->functional) FunctionType(std::forward<F>(functional));
1097-
return *this;
1098-
}
1099-
11001043
DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
11011044
{
11021045
if (FUNC == kind)
@@ -1341,17 +1284,6 @@ namespace delegate
13411284
return *this;
13421285
}
13431286

1344-
template<typename F> DelegateImpl& operator=(F functional)
1345-
{
1346-
if (FPA == kind)
1347-
{
1348-
obj.~A();
1349-
}
1350-
kind = FP;
1351-
fn = std::forward<F>(functional);
1352-
return *this;
1353-
}
1354-
13551287
DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
13561288
{
13571289
if (FPA == kind)
@@ -1550,17 +1482,6 @@ namespace delegate
15501482
return *this;
15511483
}
15521484

1553-
template<typename F> DelegateImpl& operator=(F functional)
1554-
{
1555-
if (FUNC == kind)
1556-
{
1557-
this->functional.~FunctionType();
1558-
}
1559-
kind = FUNC;
1560-
new (&this->functional) FunctionType(std::forward<F>(functional));
1561-
return *this;
1562-
}
1563-
15641485
DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
15651486
{
15661487
if (FUNC == kind)
@@ -1701,12 +1622,6 @@ namespace delegate
17011622
return *this;
17021623
}
17031624

1704-
template<typename F> DelegateImpl& operator=(F functional)
1705-
{
1706-
fn = std::forward<F>(functional);
1707-
return *this;
1708-
}
1709-
17101625
DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
17111626
{
17121627
fn = nullptr;
@@ -1768,15 +1683,15 @@ namespace delegate
17681683
static_cast<const detail::DelegatePImpl<A, R, P...>&>(del)) {}
17691684

17701685
Delegate(Delegate&& del) : detail::DelegatePImpl<A, R, P...>::DelegatePImpl(
1771-
std::move(static_cast<detail::DelegatePImpl<A, R, P...>&>(del))) {}
1686+
std::move(static_cast<detail::DelegatePImpl<A, R, P...>&&>(del))) {}
17721687

17731688
Delegate(FunAPtr fnA, const A& obj) : detail::DelegatePImpl<A, R, P...>::DelegatePImpl(fnA, obj) {}
17741689

17751690
Delegate(FunAPtr fnA, A&& obj) : detail::DelegatePImpl<A, R, P...>::DelegatePImpl(fnA, std::move(obj)) {}
17761691

17771692
Delegate(FunPtr fn) : detail::DelegatePImpl<A, R, P...>::DelegatePImpl(fn) {}
17781693

1779-
template<typename F> Delegate(F functional) : detail::DelegatePImpl<A, R, P...>::DelegatePImpl(std::forward<F>(functional)) {}
1694+
template<typename F> Delegate(F functional) : detail::DelegatePImpl<A, R, P...>::DelegatePImpl(functional) {}
17801695

17811696
Delegate& operator=(const Delegate& del) {
17821697
detail::DelegatePImpl<A, R, P...>::operator=(del);
@@ -1793,11 +1708,6 @@ namespace delegate
17931708
return *this;
17941709
}
17951710

1796-
template<typename F> Delegate& operator=(F functional) {
1797-
detail::DelegatePImpl<A, R, P...>::operator=(std::forward<F>(functional));
1798-
return *this;
1799-
}
1800-
18011711
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
18021712
detail::DelegatePImpl<A, R, P...>::operator=(nullptr);
18031713
return *this;
@@ -1854,13 +1764,13 @@ namespace delegate
18541764
static_cast<const detail::DelegatePImpl<A*, R, P...>&>(del)) {}
18551765

18561766
Delegate(Delegate&& del) : detail::DelegatePImpl<A*, R, P...>::DelegatePImpl(
1857-
std::move(static_cast<detail::DelegatePImpl<A*, R, P...>&>(del))) {}
1767+
std::move(static_cast<detail::DelegatePImpl<A*, R, P...>&&>(del))) {}
18581768

18591769
Delegate(FunAPtr fnA, A* obj) : detail::DelegatePImpl<A*, R, P...>::DelegatePImpl(fnA, obj) {}
18601770

18611771
Delegate(FunPtr fn) : detail::DelegatePImpl<A*, R, P...>::DelegatePImpl(fn) {}
18621772

1863-
template<typename F> Delegate(F functional) : detail::DelegatePImpl<A*, R, P...>::DelegatePImpl(std::forward<F>(functional)) {}
1773+
template<typename F> Delegate(F functional) : detail::DelegatePImpl<A*, R, P...>::DelegatePImpl(functional) {}
18641774

18651775
Delegate& operator=(const Delegate& del) {
18661776
detail::DelegatePImpl<A*, R, P...>::operator=(del);
@@ -1877,11 +1787,6 @@ namespace delegate
18771787
return *this;
18781788
}
18791789

1880-
template<typename F> Delegate& operator=(F functional) {
1881-
detail::DelegatePImpl<A*, R, P...>::operator=(std::forward<F>(functional));
1882-
return *this;
1883-
}
1884-
18851790
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
18861791
detail::DelegatePImpl<A*, R, P...>::operator=(nullptr);
18871792
return *this;
@@ -1917,11 +1822,11 @@ namespace delegate
19171822
static_cast<const detail::DelegatePImpl<void, R, P...>&>(del)) {}
19181823

19191824
Delegate(Delegate&& del) : detail::DelegatePImpl<void, R, P...>::DelegatePImpl(
1920-
std::move(static_cast<detail::DelegatePImpl<void, R, P...>&>(del))) {}
1825+
std::move(static_cast<detail::DelegatePImpl<void, R, P...>&&>(del))) {}
19211826

19221827
Delegate(FunPtr fn) : detail::DelegatePImpl<void, R, P...>::DelegatePImpl(fn) {}
19231828

1924-
template<typename F> Delegate(F functional) : detail::DelegatePImpl<void, R, P...>::DelegatePImpl(std::forward<F>(functional)) {}
1829+
template<typename F> Delegate(F functional) : detail::DelegatePImpl<void, R, P...>::DelegatePImpl(functional) {}
19251830

19261831
Delegate& operator=(const Delegate& del) {
19271832
detail::DelegatePImpl<void, R, P...>::operator=(del);
@@ -1938,11 +1843,6 @@ namespace delegate
19381843
return *this;
19391844
}
19401845

1941-
template<typename F> Delegate& operator=(F functional) {
1942-
detail::DelegatePImpl<void, R, P...>::operator=(std::forward<F>(functional));
1943-
return *this;
1944-
}
1945-
19461846
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
19471847
detail::DelegatePImpl<void, R, P...>::operator=(nullptr);
19481848
return *this;
@@ -1979,15 +1879,15 @@ namespace delegate
19791879
static_cast<const detail::DelegateImpl<A, R>&>(del)) {}
19801880

19811881
Delegate(Delegate&& del) : detail::DelegateImpl<A, R>::DelegateImpl(
1982-
std::move(static_cast<detail::DelegateImpl<A, R>&>(del))) {}
1882+
std::move(static_cast<detail::DelegateImpl<A, R>&&>(del))) {}
19831883

19841884
Delegate(FunAPtr fnA, const A& obj) : detail::DelegateImpl<A, R>::DelegateImpl(fnA, obj) {}
19851885

19861886
Delegate(FunAPtr fnA, A&& obj) : detail::DelegateImpl<A, R>::DelegateImpl(fnA, std::move(obj)) {}
19871887

19881888
Delegate(FunPtr fn) : detail::DelegateImpl<A, R>::DelegateImpl(fn) {}
19891889

1990-
template<typename F> Delegate(F functional) : detail::DelegateImpl<A, R>::DelegateImpl(std::forward<F>(functional)) {}
1890+
template<typename F> Delegate(F functional) : detail::DelegateImpl<A, R>::DelegateImpl(functional) {}
19911891

19921892
Delegate& operator=(const Delegate& del) {
19931893
detail::DelegateImpl<A, R>::operator=(del);
@@ -2004,11 +1904,6 @@ namespace delegate
20041904
return *this;
20051905
}
20061906

2007-
template<typename F> Delegate& operator=(F functional) {
2008-
detail::DelegateImpl<A, R>::operator=(std::forward<F>(functional));
2009-
return *this;
2010-
}
2011-
20121907
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
20131908
detail::DelegateImpl<A, R>::operator=(nullptr);
20141909
return *this;
@@ -2065,13 +1960,13 @@ namespace delegate
20651960
static_cast<const detail::DelegateImpl<A*, R>&>(del)) {}
20661961

20671962
Delegate(Delegate&& del) : detail::DelegateImpl<A*, R>::DelegateImpl(
2068-
std::move(static_cast<detail::DelegateImpl<A*, R>&>(del))) {}
1963+
std::move(static_cast<detail::DelegateImpl<A*, R>&&>(del))) {}
20691964

20701965
Delegate(FunAPtr fnA, A* obj) : detail::DelegateImpl<A*, R>::DelegateImpl(fnA, obj) {}
20711966

20721967
Delegate(FunPtr fn) : detail::DelegateImpl<A*, R>::DelegateImpl(fn) {}
20731968

2074-
template<typename F> Delegate(F functional) : detail::DelegateImpl<A*, R>::DelegateImpl(std::forward<F>(functional)) {}
1969+
template<typename F> Delegate(F functional) : detail::DelegateImpl<A*, R>::DelegateImpl(functional) {}
20751970

20761971
Delegate& operator=(const Delegate& del) {
20771972
detail::DelegateImpl<A*, R>::operator=(del);
@@ -2088,11 +1983,6 @@ namespace delegate
20881983
return *this;
20891984
}
20901985

2091-
template<typename F> Delegate& operator=(F functional) {
2092-
detail::DelegateImpl<A*, R>::operator=(std::forward<F>(functional));
2093-
return *this;
2094-
}
2095-
20961986
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
20971987
detail::DelegateImpl<A*, R>::operator=(nullptr);
20981988
return *this;
@@ -2128,11 +2018,11 @@ namespace delegate
21282018
static_cast<const detail::DelegateImpl<void, R>&>(del)) {}
21292019

21302020
Delegate(Delegate&& del) : detail::DelegateImpl<void, R>::DelegateImpl(
2131-
std::move(static_cast<detail::DelegateImpl<void, R>&>(del))) {}
2021+
std::move(static_cast<detail::DelegateImpl<void, R>&&>(del))) {}
21322022

21332023
Delegate(FunPtr fn) : detail::DelegateImpl<void, R>::DelegateImpl(fn) {}
21342024

2135-
template<typename F> Delegate(F functional) : detail::DelegateImpl<void, R>::DelegateImpl(std::forward<F>(functional)) {}
2025+
template<typename F> Delegate(F functional) : detail::DelegateImpl<void, R>::DelegateImpl(functional) {}
21362026

21372027
Delegate& operator=(const Delegate& del) {
21382028
detail::DelegateImpl<void, R>::operator=(del);
@@ -2149,11 +2039,6 @@ namespace delegate
21492039
return *this;
21502040
}
21512041

2152-
template<typename F> Delegate& operator=(F functional) {
2153-
detail::DelegateImpl<void, R>::operator=(std::forward<F>(functional));
2154-
return *this;
2155-
}
2156-
21572042
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
21582043
detail::DelegateImpl<void, R>::operator=(nullptr);
21592044
return *this;
@@ -2174,15 +2059,15 @@ template<typename A, typename R, typename... P> class Delegate<R(P...), A> : pub
21742059
static_cast<const delegate::detail::Delegate<A, R, P...>&>(del)) {}
21752060

21762061
Delegate(Delegate&& del) : delegate::detail::Delegate<A, R, P...>::Delegate(
2177-
std::move(static_cast<delegate::detail::Delegate<A, R, P...>&>(del))) {}
2062+
std::move(static_cast<delegate::detail::Delegate<A, R, P...>&&>(del))) {}
21782063

21792064
Delegate(typename delegate::detail::Delegate<A, R, P...>::FunAPtr fnA, const A& obj) : delegate::detail::Delegate<A, R, P...>::Delegate(fnA, obj) {}
21802065

21812066
Delegate(typename delegate::detail::Delegate<A, R, P...>::FunAPtr fnA, A&& obj) : delegate::detail::Delegate<A, R, P...>::Delegate(fnA, std::move(obj)) {}
21822067

21832068
Delegate(typename delegate::detail::Delegate<A, R, P...>::FunPtr fn) : delegate::detail::Delegate<A, R, P...>::Delegate(fn) {}
21842069

2185-
template<typename F> Delegate(F functional) : delegate::detail::Delegate<A, R, P...>::Delegate(std::forward<F>(functional)) {}
2070+
template<typename F> Delegate(F functional) : delegate::detail::Delegate<A, R, P...>::Delegate(functional) {}
21862071

21872072
Delegate& operator=(const Delegate& del) {
21882073
delegate::detail::Delegate<A, R, P...>::operator=(del);
@@ -2199,17 +2084,11 @@ template<typename A, typename R, typename... P> class Delegate<R(P...), A> : pub
21992084
return *this;
22002085
}
22012086

2202-
template<typename F> Delegate& operator=(F functional) {
2203-
delegate::detail::Delegate<A, R, P...>::operator=(std::forward<F>(functional));
2204-
return *this;
2205-
}
2206-
22072087
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
22082088
delegate::detail::Delegate<A, R, P...>::operator=(nullptr);
22092089
return *this;
22102090
}
22112091
};
2212-
22132092
template<typename R, typename... P> class Delegate<R(P...)> : public delegate::detail::Delegate<void, R, P...>
22142093
{
22152094
public:
@@ -2221,11 +2100,11 @@ template<typename R, typename... P> class Delegate<R(P...)> : public delegate::d
22212100
static_cast<const delegate::detail::Delegate<void, R, P...>&>(del)) {}
22222101

22232102
Delegate(Delegate&& del) : delegate::detail::Delegate<void, R, P...>::Delegate(
2224-
std::move(static_cast<delegate::detail::Delegate<void, R, P...>&>(del))) {}
2103+
std::move(static_cast<delegate::detail::Delegate<void, R, P...>&&>(del))) {}
22252104

22262105
Delegate(typename delegate::detail::Delegate<void, R, P...>::FunPtr fn) : delegate::detail::Delegate<void, R, P...>::Delegate(fn) {}
22272106

2228-
template<typename F> Delegate(F functional) : delegate::detail::Delegate<void, R, P...>::Delegate(std::forward<F>(functional)) {}
2107+
template<typename F> Delegate(F functional) : delegate::detail::Delegate<void, R, P...>::Delegate(functional) {}
22292108

22302109
Delegate& operator=(const Delegate& del) {
22312110
delegate::detail::Delegate<void, R, P...>::operator=(del);
@@ -2242,11 +2121,6 @@ template<typename R, typename... P> class Delegate<R(P...)> : public delegate::d
22422121
return *this;
22432122
}
22442123

2245-
template<typename F> Delegate& operator=(F functional) {
2246-
delegate::detail::Delegate<void, R, P...>::operator=(std::forward<F>(functional));
2247-
return *this;
2248-
}
2249-
22502124
Delegate& IRAM_ATTR operator=(std::nullptr_t) {
22512125
delegate::detail::Delegate<void, R, P...>::operator=(nullptr);
22522126
return *this;

0 commit comments

Comments
 (0)
0