summaryrefslogtreecommitdiffstats
path: root/source/core/slang-range.h
blob: e85ce6a9d5a67be5c9a74bf8459f4c1a601e4601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#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;
}

} // namespace Slang

#endif // SLANG_CORE_RANGE_H