-
-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
#include<stdint.h>
template<typename... Ts>
struct InfoArray {
uint8_t Number = sizeof...(Ts);
};
The code above does not compile.
C:\Users\vhtmf\Documents\Arduino\sketch_nov5a\sketch_nov5a.ino:4:20: error: expected ';' at end of member declaration
uint8_t Number = sizeof...(Ts);
^
C:\Users\vhtmf\Documents\Arduino\sketch_nov5a\sketch_nov5a.ino:4:26: error: expected unqualified-id before '...' token
uint8_t Number = sizeof...(Ts);
^
C:\Users\vhtmf\Documents\Arduino\sketch_nov5a\sketch_nov5a.ino:4:20: error: expected primary-expression at end of input
uint8_t Number = sizeof...(Ts);
^
exit status 1
Compilation error: expected ';' at end of member declaration
Metadata
Metadata
Assignees
Labels
No labels
Activity
christyogi commentedon Mar 3, 2025
Use
constexpr static uint8_t Number = sizeof...(Ts);
Ebola-Chan-bot commentedon Mar 3, 2025
Your code doesn't have the same meaning as mine. What I need must be a non-static member variable.
christyogi commentedon Mar 3, 2025
This maybe?
christyogi commentedon Mar 3, 2025
Just doing
seems fine in fact
Ebola-Chan-bot commentedon Mar 3, 2025
This is exactly what I did as a workaround.