Skip to content

Commit

Permalink
Core (LV::Palette): Add methods for iteration.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaixiong committed Jan 25, 2025
1 parent 9d0f64b commit a530883
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions libvisual/libvisual/lv_palette.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ namespace LV {
//!
struct LV_API Palette
{
using const_iterator = std::vector<Color>::const_iterator;
using iterator = std::vector<Color>::iterator;

std::vector<Color> colors;

/**
Expand Down Expand Up @@ -80,6 +83,36 @@ namespace LV {
return !(lhs == rhs);
}

constexpr const_iterator cbegin () const noexcept
{
return colors.cbegin ();
}

constexpr const_iterator cend () const noexcept
{
return colors.cend ();
}

constexpr const_iterator begin () const noexcept
{
return colors.begin ();
}

constexpr const_iterator end () const noexcept
{
return colors.end ();
}

constexpr iterator begin () noexcept
{
return colors.begin ();
}

constexpr iterator end () noexcept
{
return colors.end ();
}

bool empty () const
{
return colors.empty ();
Expand Down

0 comments on commit a530883

Please sign in to comment.