libkazv
Loading...
Searching...
No Matches
range-t.hpp
Go to the documentation of this file.
1/*
2 * This file is part of libkazv.
3 * SPDX-FileCopyrightText: 2021 Tusooa Zhu <tusooa@kazv.moe>
4 * SPDX-License-Identifier: AGPL-3.0-or-later
5 */
6
7#pragma once
8
9static_assert(false, "This is an *interface*, not an actual class in the library.");
10
11#include <cstddef>
12
19template<class T>
20class RangeT
21{
22public:
24 using DataT = T;
25
29 auto begin() const;
30
34 auto end() const;
35
41 const DataT &at(std::size_t index) const;
42
49 const DataT &operator[](std::size_t index) const;
50};
A RangeT is an ordered collection that can be iterated through.
Definition range-t.hpp:21
auto end() const
The past-end iterator of this range.
const DataT & at(std::size_t index) const
Get the item at index with bound-checking.
const DataT & operator[](std::size_t index) const
Get the item at index without bound-checking.
T DataT
The type of items in this range.
Definition range-t.hpp:24
auto begin() const
The beginning iterator of this range.