Skip to content

Commit a530883

Browse files
committed
Core (LV::Palette): Add methods for iteration.
1 parent 9d0f64b commit a530883

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
@@ -45,6 +45,9 @@ namespace LV {
4545
//!
4646
struct LV_API Palette
4747
{
48+
using const_iterator = std::vector<Color>::const_iterator;
49+
using iterator = std::vector<Color>::iterator;
50+
4851
std::vector<Color> colors;
4952

5053
/**
@@ -80,6 +83,36 @@ namespace LV {
8083
return !(lhs == rhs);
8184
}
8285

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

0 commit comments

Comments
 (0)