FastLED 3.9.15
Loading...
Searching...
No Matches
range_access.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stdint.h"
4
5namespace fl {
6
7// fl::begin for arrays
8template <typename T, size_t N>
9constexpr T* begin(T (&array)[N]) noexcept {
10 return array;
11}
12
13// fl::end for arrays
14template <typename T, size_t N>
15constexpr T* end(T (&array)[N]) noexcept {
16 return array + N;
17}
18
19// fl::begin for containers with begin() member function
20template <typename Container>
21constexpr auto begin(Container& c) -> decltype(c.begin()) {
22 return c.begin();
23}
24
25// fl::begin for const containers with begin() member function
26template <typename Container>
27constexpr auto begin(const Container& c) -> decltype(c.begin()) {
28 return c.begin();
29}
30
31// fl::end for containers with end() member function
32template <typename Container>
33constexpr auto end(Container& c) -> decltype(c.end()) {
34 return c.end();
35}
36
37// fl::end for const containers with end() member function
38template <typename Container>
39constexpr auto end(const Container& c) -> decltype(c.end()) {
40 return c.end();
41}
42
43} // namespace fl
44
A fixed-size array implementation similar to std::array.
Definition array.h:19
constexpr T * begin(T(&array)[N]) noexcept
Definition range_access.h:9
constexpr T * end(T(&array)[N]) noexcept
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16