WPILibC++
2025.3.2
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
Enumerations
a
b
c
d
e
f
h
i
l
m
n
o
p
r
s
t
u
v
Enumerator
a
b
c
f
h
i
k
l
m
o
p
s
t
u
w
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
Enumerator
a
b
c
f
i
k
m
o
p
r
s
v
Related Symbols
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
b
c
d
e
f
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
a
c
e
h
m
n
p
r
s
t
u
w
Enumerator
c
h
i
m
n
p
u
w
Macros
_
a
c
d
e
f
g
h
i
j
k
l
m
n
p
r
s
t
u
v
w
x
▼
WPILibC++
LICENSE
Deprecated List
Todo List
►
Topics
►
Namespaces
►
Concepts
►
Classes
▼
Files
▼
File List
►
cameraserver
►
debugging
►
fmt
►
frc
►
frc
►
frc
►
frc
►
frc
►
frc
►
frc2
►
frc2
►
generated
►
generated
►
generated
►
hal
►
networktables
►
thirdparty
►
thirdparty
►
thirdparty
►
units
►
vision
▼
wpi
►
fmt
►
protobuf
►
sendable
►
struct
►
Algorithm.h
►
array.h
►
Base64.h
►
CallbackManager.h
►
circular_buffer.h
►
condition_variable.h
►
ct_string.h
►
DataLog.h
►
DataLog_c.h
►
DataLogBackgroundWriter.h
►
DataLogReader.h
►
DataLogWriter.h
►
DecayedDerivedFrom.h
►
Demangle.h
►
deprecated.h
►
EventVector.h
►
FastQueue.h
►
FileLogger.h
►
fs.h
►
future.h
►
interpolating_map.h
►
jni_util.h
►
leb128.h
►
Logger.h
►
MappedFileRegion.h
►
MessagePack.h
►
mutex.h
►
nodiscard.h
►
NullDeleter.h
►
print.h
priority_mutex.h
►
priority_queue.h
►
ProtoHelper.h
►
raw_istream.h
►
RawFrame.h
►
rotated_span.h
►
RuntimeCheck.h
►
SafeThread.h
►
scope
►
sha1.h
►
SpanExtras.h
►
spinlock.h
►
StackTrace.h
►
static_circular_buffer.h
►
string.h
►
StringMap.h
►
SymbolExports.h
►
Synchronization.h
►
timestamp.h
►
UidVector.h
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpimath
►
wpinet
cscore.h
►
cscore_c.h
►
cscore_cpp.h
►
cscore_cv.h
cscore_oo.h
►
cscore_raw.h
►
cscore_runloop.h
ntcore.h
►
ntcore_c.h
►
ntcore_cpp.h
►
ntcore_test.h
►
WPILibVersion.h
debugging.hpp
►
pb.h
►
pb_common.h
►
pb_decode.h
►
pb_encode.h
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
array.h
Go to the documentation of this file.
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
#pragma once
6
7
#include <array>
8
#include <concepts>
9
#include <cstddef>
10
#include <tuple>
11
#include <utility>
12
13
namespace
wpi
{
14
15
struct
empty_array_t
{};
16
constexpr
empty_array_t
empty_array
;
17
18
/**
19
* This class is a wrapper around std::array that does compile time size
20
* checking.
21
*
22
* std::array's implicit constructor can result in uninitialized elements if the
23
* number of arguments doesn't match the std::array size.
24
*/
25
template
<
typename
T,
size_t
N>
26
class
array
:
public
std::array<T, N> {
27
public
:
28
constexpr
explicit
array
(
empty_array_t
) {}
29
30
template
<std::convertible_to<T>... Ts>
31
requires
(1 +
sizeof
...(Ts) == N)
32
constexpr
array
(T
arg
, Ts&&... args)
// NOLINT
33
: std::array<T, N>{std::forward<T>(
arg
), std::forward<Ts>(args)...} {}
32
constexpr
array
(T
arg
, Ts&&... args)
// NOLINT
{
…
}
34
35
constexpr
array
(
const
array<T, N>
&) =
default
;
36
constexpr
array
&
operator=
(
const
array<T, N>
&) =
default
;
37
constexpr
array
(
array<T, N>
&&) =
default
;
38
constexpr
array
&
operator=
(
array<T, N>
&&) =
default
;
39
40
constexpr
array
(
const
std::array<T, N>& rhs) {
// NOLINT
41
*
static_cast<
std::array<T, N>*
>
(
this
) = rhs;
42
}
40
constexpr
array
(
const
std::array<T, N>& rhs) {
// NOLINT
{
…
}
43
44
constexpr
array
&
operator=
(
const
std::array<T, N>& rhs) {
45
*
static_cast<
std::array<T, N>*
>
(
this
) = rhs;
46
return
*
this
;
47
}
44
constexpr
array
&
operator=
(
const
std::array<T, N>& rhs) {
…
}
48
49
constexpr
array
(std::array<T, N>&& rhs) {
// NOLINT
50
*
static_cast<
std::array<T, N>*
>
(
this
) = rhs;
51
}
49
constexpr
array
(std::array<T, N>&& rhs) {
// NOLINT
{
…
}
52
53
constexpr
array
&
operator=
(std::array<T, N>&& rhs) {
54
*
static_cast<
std::array<T, N>*
>
(
this
) = rhs;
55
return
*
this
;
56
}
53
constexpr
array
&
operator=
(std::array<T, N>&& rhs) {
…
}
57
};
26
class
array
:
public
std::array<T, N> {
…
};
58
59
template
<
typename
T, std::convertible_to<T>... Ts>
60
array
(T, Ts...) ->
array
<T, 1 +
sizeof
...(Ts)>;
61
62
}
// namespace wpi
63
64
template
<
size_t
I,
typename
T,
size_t
N>
65
requires
(I < N)
66
constexpr
T&
get
(
wpi::array<T, N>
& arr)
noexcept
{
67
return
std::get<I>(
static_cast<
std::array<T, N>
>
(arr));
68
}
66
constexpr
T&
get
(
wpi::array<T, N>
& arr)
noexcept
{
…
}
69
70
template
<
size_t
I,
typename
T,
size_t
N>
71
requires
(I < N)
72
constexpr
T&&
get
(
wpi::array<T, N>
&& arr)
noexcept
{
73
return
std::move(std::get<I>(arr));
74
}
72
constexpr
T&&
get
(
wpi::array<T, N>
&& arr)
noexcept
{
…
}
75
76
template
<
size_t
I,
typename
T,
size_t
N>
77
requires
(I < N)
78
constexpr
const
T&
get
(
const
wpi::array<T, N>
& arr)
noexcept
{
79
return
std::get<I>(
static_cast<
std::array<T, N>
>
(arr));
80
}
78
constexpr
const
T&
get
(
const
wpi::array<T, N>
& arr)
noexcept
{
…
}
81
82
template
<
size_t
I,
typename
T,
size_t
N>
83
requires
(I < N)
84
constexpr
const
T&&
get
(
const
wpi::array<T, N>
&& arr)
noexcept
{
85
return
std::move(std::get<I>(arr));
86
}
84
constexpr
const
T&&
get
(
const
wpi::array<T, N>
&& arr)
noexcept
{
…
}
87
88
// Enables structured bindings
89
namespace
std
{
// NOLINT
90
// Partial specialization for wpi::array
91
template
<
typename
T,
size_t
N>
92
struct
tuple_size<
wpi
::array<T, N>> :
public
integral_constant<size_t, N> {};
93
94
// Partial specialization for wpi::array
95
template
<
size_t
I,
typename
T,
size_t
N>
96
requires
(I < N)
97
struct
tuple_element<I,
wpi::array<T, N>
> {
98
using
type
= T;
99
};
97
struct
tuple_element<I,
wpi::array<T, N>
> {
…
};
100
}
// namespace std
get
constexpr T & get(wpi::array< T, N > &arr) noexcept
Definition
array.h:66
wpi::array
This class is a wrapper around std::array that does compile time size checking.
Definition
array.h:26
wpi::array::operator=
constexpr array & operator=(std::array< T, N > &&rhs)
Definition
array.h:53
wpi::array::operator=
constexpr array & operator=(const std::array< T, N > &rhs)
Definition
array.h:44
wpi::array::operator=
constexpr array & operator=(const array< T, N > &)=default
wpi::array::array
constexpr array(const std::array< T, N > &rhs)
Definition
array.h:40
wpi::array::array
constexpr array(std::array< T, N > &&rhs)
Definition
array.h:49
wpi::array::array
constexpr array(const array< T, N > &)=default
wpi::array::array
constexpr array(array< T, N > &&)=default
wpi::array::operator=
constexpr array & operator=(array< T, N > &&)=default
wpi::array::array
constexpr array(empty_array_t)
Definition
array.h:28
wpi::array::array
constexpr array(T arg, Ts &&... args)
Definition
array.h:32
std
Implement std::hash so that hash_code can be used in STL containers.
Definition
PointerIntPair.h:280
wpi
Foonathan namespace.
Definition
ntcore_cpp.h:26
wpi::array
array(T, Ts...) -> array< T, 1+sizeof...(Ts)>
wpi::empty_array
constexpr empty_array_t empty_array
Definition
array.h:16
std::tuple_element< I, wpi::array< T, N > >::type
T type
Definition
array.h:98
wpi::empty_array_t
Definition
array.h:15
arg
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Returns a named argument to be used in a formatting function.
Definition
base.h:2775
wpi
array.h
Generated on Mon Mar 17 2025 23:50:34 for WPILibC++ by
1.12.0