summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-range.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/core/slang-range.h b/source/core/slang-range.h
new file mode 100644
index 000000000..6e4419ce0
--- /dev/null
+++ b/source/core/slang-range.h
@@ -0,0 +1,29 @@
+#ifndef SLANG_CORE_RANGE_H
+#define SLANG_CORE_RANGE_H
+
+namespace Slang
+{
+ template<typename T>
+ struct Range
+ {
+ T begin = 0;
+ T end = 0;
+
+ bool inRange(T val) const
+ {
+ return val >= begin && val < end;
+ }
+ };
+
+ template <typename T>
+ Range<T> makeRange(T begin, T end)
+ {
+ Range<T> result;
+ result.begin = begin;
+ result.end = end;
+ return result;
+ }
+
+}
+
+#endif //SLANG_CORE_RANGE_H