extract util: isSameObject (bare ptr comparison)
This commit is contained in:
parent
98510cc943
commit
c48f9086b7
2 changed files with 15 additions and 9 deletions
|
|
@ -201,6 +201,19 @@ namespace util {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** compare plain object identity,
|
||||||
|
* bypassing any custom comparison operators.
|
||||||
|
*/
|
||||||
|
template<class A, class B>
|
||||||
|
inline bool
|
||||||
|
isSameObject (A const& a, B const& b)
|
||||||
|
{
|
||||||
|
return static_cast<const void*> (&a)
|
||||||
|
== static_cast<const void*> (&b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** produce an identifier based on the given string.
|
/** produce an identifier based on the given string.
|
||||||
* remove non-standard-chars, reduce sequences of punctuation
|
* remove non-standard-chars, reduce sequences of punctuation
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,11 @@
|
||||||
#include "proc/mobject/placement-index.hpp"
|
#include "proc/mobject/placement-index.hpp"
|
||||||
#include "proc/mobject/explicitplacement.hpp"
|
#include "proc/mobject/explicitplacement.hpp"
|
||||||
#include "proc/mobject/test-dummy-mobject.hpp"
|
#include "proc/mobject/test-dummy-mobject.hpp"
|
||||||
|
#include "lib/util.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
using util::isSameObject;
|
||||||
using lumiera::Time;
|
using lumiera::Time;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
|
@ -45,15 +47,6 @@ namespace test {
|
||||||
typedef TestPlacement<TestSubMO21> PSub;
|
typedef TestPlacement<TestSubMO21> PSub;
|
||||||
|
|
||||||
|
|
||||||
template<class A, class B>
|
|
||||||
inline bool
|
|
||||||
isSameObject (A const& a, B const& b)
|
|
||||||
{
|
|
||||||
return static_cast<const void*> (&a)
|
|
||||||
== static_cast<const void*> (&b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* @test properties and behaviour of the reference-mechanism for Placements.
|
* @test properties and behaviour of the reference-mechanism for Placements.
|
||||||
* We create an mock placement index and install it to be used
|
* We create an mock placement index and install it to be used
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue