equality comparisons on function erasure objects covered
...well, as good as possible, as boost refuses to implement this feature
This commit is contained in:
parent
231278bafe
commit
fea85acd0e
2 changed files with 19 additions and 5 deletions
|
|
@ -184,7 +184,9 @@ namespace typelist{
|
||||||
operator== (StoreFunPtr const& o1,
|
operator== (StoreFunPtr const& o1,
|
||||||
StoreFunPtr const& o2)
|
StoreFunPtr const& o2)
|
||||||
{
|
{
|
||||||
return o1.asBase() == o2.asBase();
|
void * *fun1 = reinterpret_cast<void**> (o1.asBase());
|
||||||
|
void * *fun2 = reinterpret_cast<void**> (o2.asBase());
|
||||||
|
return *fun1 == *fun2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,13 @@ namespace test {
|
||||||
check_Comparisons (Efp(testFunc), Efp(returnIt));
|
check_Comparisons (Efp(testFunc), Efp(returnIt));
|
||||||
check_Comparisons (Evoid(testFunc), Evoid(returnIt));
|
check_Comparisons (Evoid(testFunc), Evoid(returnIt));
|
||||||
|
|
||||||
|
ASSERT ( detect_Clone (Efun(testFunc)));
|
||||||
|
ASSERT (!detect_Clone (Efun(bindFunc))); //note equality not detected when cloning a bind term
|
||||||
|
ASSERT (!detect_Clone (Efun(pAplFunc))); //similarly
|
||||||
|
ASSERT (!detect_Clone (Efun(membFunc))); //analogous for bound member function
|
||||||
|
ASSERT ( detect_Clone (Efp(testFunc) ));
|
||||||
|
ASSERT ( detect_Clone (Evoid(testFunc)));
|
||||||
|
|
||||||
detect_unboundFunctor(Efun(testFunc), Efun(getterFunc), Efun(membFunc));
|
detect_unboundFunctor(Efun(testFunc), Efun(getterFunc), Efun(membFunc));
|
||||||
detect_unboundFunctor(Efp(testFunc),Efp(&testFunc), Efp(returnIt));
|
detect_unboundFunctor(Efp(testFunc),Efp(&testFunc), Efp(returnIt));
|
||||||
detect_unboundFunctor(Evoid(testFunc),Evoid(&testFunc),Evoid(returnIt));
|
detect_unboundFunctor(Evoid(testFunc),Evoid(&testFunc),Evoid(returnIt));
|
||||||
|
|
@ -229,10 +236,15 @@ namespace test {
|
||||||
|
|
||||||
ASSERT (h1 != h2);
|
ASSERT (h1 != h2);
|
||||||
ASSERT (h2 != h1);
|
ASSERT (h2 != h1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class HOL>
|
||||||
|
bool
|
||||||
|
detect_Clone (HOL const& h1)
|
||||||
|
{
|
||||||
HOL clone (h1);
|
HOL clone (h1);
|
||||||
ASSERT (clone == h1);
|
return (clone == h1);
|
||||||
ASSERT (clone != h2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue