aboutsummaryrefslogtreecommitdiff
path: root/include/proj/util.hpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-11-21 13:55:11 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-11-21 13:55:11 +0100
commit3dea81d9be4712aa90ba79f333338c0b3ecb21e2 (patch)
tree3cc07bee202b24748f2f27198d684db157e542b9 /include/proj/util.hpp
parent571096201bf2cb1dde8933eb3fb7091e12ebbbe4 (diff)
downloadPROJ-3dea81d9be4712aa90ba79f333338c0b3ecb21e2.tar.gz
PROJ-3dea81d9be4712aa90ba79f333338c0b3ecb21e2.zip
Make GeographicCRS/GeodeticCRS::isEquivalentTo() work properly when comparing to a DerivedGeographicCRS/DerivedGeodeticCRS
Diffstat (limited to 'include/proj/util.hpp')
-rw-r--r--include/proj/util.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/proj/util.hpp b/include/proj/util.hpp
index 3d85e579..2ada4f79 100644
--- a/include/proj/util.hpp
+++ b/include/proj/util.hpp
@@ -213,6 +213,14 @@ template <typename T> using nn_shared_ptr = nn<std::shared_ptr<T>>;
// To avoid formatting differences between clang-format 3.8 and 7
#define PROJ_NOEXCEPT noexcept
+//! @cond Doxygen_Suppress
+// isOfExactType<MyType>(*p) checks that the type of *p is exactly MyType
+template <typename TemplateT, typename ObjectT>
+inline bool isOfExactType(const ObjectT &o) {
+ return typeid(TemplateT).hash_code() == typeid(o).hash_code();
+}
+//! @endcond
+
/** \brief Loose transposition of [std::optional]
* (https://en.cppreference.com/w/cpp/utility/optional) available from C++17. */
template <class T> class optional {