summaryrefslogtreecommitdiff
path: root/src/range.hh
blob: 6e72ffba474a0e070aa7cedce4b9ee76ab1c1f5b (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
#ifndef range_hh_INCLUDED
#define range_hh_INCLUDED

#include <cstddef>

namespace Kakoune
{

template<typename T>
struct Range
{
    T begin;
    T end;

    friend bool operator==(const Range& lhs, const Range& rhs) = default;

    friend size_t hash_value(const Range& range)
    {
        return hash_values(range.begin, range.end);
    }

    bool empty() const { return begin == end; }
};

}

#endif // range_hh_INCLUDED