Skip to content

Commit 5a3a3c8

Browse files
committed
Core (LV::Palette): Add methods for iteration.
1 parent 13ae51e commit 5a3a3c8

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

libvisual/libvisual/lv_palette.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ namespace LV {
4646
//!
4747
struct LV_API Palette
4848
{
49+
using const_iterator = std::vector<Color>::const_iterator;
50+
using iterator = std::vector<Color>::iterator;
51+
4952
std::vector<Color> colors;
5053

5154
/**
@@ -81,6 +84,36 @@ namespace LV {
8184
return !(lhs == rhs);
8285
}
8386

87+
constexpr const_iterator cbegin () const noexcept
88+
{
89+
return colors.cbegin ();
90+
}
91+
92+
constexpr const_iterator cend () const noexcept
93+
{
94+
return colors.cend ();
95+
}
96+
97+
constexpr const_iterator begin () const noexcept
98+
{
99+
return colors.cbegin ();
100+
}
101+
102+
constexpr const_iterator end () const noexcept
103+
{
104+
return colors.cend ();
105+
}
106+
107+
constexpr iterator begin () noexcept
108+
{
109+
return colors.begin ();
110+
}
111+
112+
constexpr iterator end () noexcept
113+
{
114+
return colors.end ();
115+
}
116+
84117
bool empty () const
85118
{
86119
return colors.empty ();

0 commit comments

Comments
 (0)