aboutsummaryrefslogtreecommitdiffstats
path: root/include/common.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/common.hpp')
-rw-r--r--include/common.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/common.hpp b/include/common.hpp
index d152bb7..d13e397 100644
--- a/include/common.hpp
+++ b/include/common.hpp
@@ -58,6 +58,12 @@ typedef unsigned int uint;
#define BREAKPOINT __asm__("int $3")
+template<typename T>
+inline const T * const& coalesce(const T * const &p1, const T * const &p2)
+{
+ return ((p1 == nullptr) ? p2 : p1);
+}
+
/**
* Creates a coordinate of integers.
*/