summaryrefslogtreecommitdiff
path: root/source/core/slang-range.h
blob: 6e4419ce09a3fd4246114599d1ee339478942216 (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
27
28
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