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/stl/stdint.h"
4#include "fl/stl/noexcept.h"
5
6namespace fl {
7
8// fl::begin for arrays
9template <typename T, fl::size N>
10constexpr T* begin(T (&array)[N]) FL_NOEXCEPT {
11 return array;
12}
13
14// fl::end for arrays
15template <typename T, fl::size N>
16constexpr T* end(T (&array)[N]) FL_NOEXCEPT {
17 return array + N;
18}
19
20// fl::begin for containers with begin() member function
21template <typename Container>
22constexpr auto begin(Container& c) -> decltype(c.begin()) {
23 return c.begin();
24}
25
26// fl::begin for const containers with begin() member function
27template <typename Container>
28constexpr auto begin(const Container& c) -> decltype(c.begin()) {
29 return c.begin();
30}
31
32// fl::end for containers with end() member function
33template <typename Container>
34constexpr auto end(Container& c) -> decltype(c.end()) {
35 return c.end();
36}
37
38// fl::end for const containers with end() member function
39template <typename Container>
40constexpr auto end(const Container& c) -> decltype(c.end()) {
41 return c.end();
42}
43
44} // namespace fl
A fixed-size array implementation similar to std::array.
Definition array.h:27
constexpr T * begin(T(&array)[N]) FL_NOEXCEPT
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT