Porytiles
Loading...
Searching...
No Matches
color_index.hpp
Go to the documentation of this file.
1#pragma once
2
3// ReSharper disable once CppUnusedIncludeDirective
4#include <compare>
5#include <cstddef>
6#include <string>
7
9
10namespace porytiles {
11
26 public:
27 // NOLINTNEXTLINE(google-explicit-constructor)
28 ColorIndex(std::size_t index) : index_{index} {}
29
30 auto operator<=>(const ColorIndex &) const = default;
31
32 // NOLINTNEXTLINE
33 operator const std::size_t &() const &
34 {
35 return index_;
36 }
37
38 // NOLINTNEXTLINE
39 operator std::size_t &&() &&
40 {
41 return std::move(index_);
42 }
43
44 [[nodiscard]] const std::size_t &value() const &
45 {
46 return index_;
47 }
48
49 [[nodiscard]] std::size_t &&value() &&
50 {
51 return std::move(index_);
52 }
53
54 [[nodiscard]] std::size_t index() const
55 {
56 return index_;
57 }
58
59 private:
60 std::size_t index_{};
61};
62
63} // namespace porytiles
Represents a color index value for palette operations.
std::size_t index() const
auto operator<=>(const ColorIndex &) const =default
const std::size_t & value() const &
ColorIndex(std::size_t index)
std::size_t && value() &&