Navigate to previous element by key (FastLED compatibility)
| 480 | |
| 481 | // Navigate to previous element by key (FastLED compatibility) |
| 482 | bool prev(const Key& key, Key* prev_key, bool allow_rollover = false) const FL_NOEXCEPT { |
| 483 | auto it = find(key); |
| 484 | if (it != end()) { |
| 485 | if (it != begin()) { |
| 486 | --it; |
| 487 | *prev_key = it->first; |
| 488 | return true; |
| 489 | } else if (allow_rollover && !empty()) { |
| 490 | *prev_key = mData.back().first; |
| 491 | return true; |
| 492 | } |
| 493 | } |
| 494 | return false; |
| 495 | } |
| 496 | |
| 497 | // Allows pre-allocating space |
| 498 | void reserve(size_type n) FL_NOEXCEPT { |