From 29c0f48f775b2c5ab0d09aebdbf4f5d3bb3c5072 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Mon, 19 Nov 2018 17:00:35 +0100 Subject: [PATCH] add 'id' function to range base --- src/include/ranges/range_base.h | 2 ++ src/lib/ranges/range_base.cc | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/include/ranges/range_base.h b/src/include/ranges/range_base.h index 454584f..92d3d9d 100644 --- a/src/include/ranges/range_base.h +++ b/src/include/ranges/range_base.h @@ -78,6 +78,8 @@ namespace MultiArrayTools bool operator==(const RangeBase& in) const; bool operator!=(const RangeBase& in) const; + std::intptr_t id() const; + virtual std::string stringMeta(size_t pos) const = 0; virtual std::vector data() const = 0; // usefull when writing to files, etc... diff --git a/src/lib/ranges/range_base.cc b/src/lib/ranges/range_base.cc index 26417fa..bfe422e 100644 --- a/src/lib/ranges/range_base.cc +++ b/src/lib/ranges/range_base.cc @@ -177,6 +177,10 @@ namespace MultiArrayTools { return this != ∈ } - + + std::intptr_t RangeBase::id() const + { + return reinterpret_cast(this); + } } // end namespace MultiArrayTools