lambda in constructor
This commit is contained in:
parent
f653fe0914
commit
d849a2d1fb
1 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,8 @@ static constexpr unsigned slen (const char * const str) {
|
|||
while (str[n]) n++;
|
||||
return n;
|
||||
}
|
||||
static constexpr unsigned char compress (const unsigned n) {
|
||||
static const TABLE<unsigned char, array_size (morse_code)> compressed_table
|
||||
([](const unsigned n) -> auto {
|
||||
const char * const ptr = morse_code [n];
|
||||
const unsigned len = slen (ptr);
|
||||
unsigned char mb = 0u;
|
||||
|
@ -32,8 +33,7 @@ static constexpr unsigned char compress (const unsigned n) {
|
|||
if (ptr [n] == '-') mb |= (1u << n);
|
||||
}
|
||||
return mb;
|
||||
}
|
||||
static const TABLE<unsigned char, array_size (morse_code)> compressed_table (compress);
|
||||
});
|
||||
extern void print_morse_table (const TABLE<unsigned char, array_size(morse_code)> & tab);
|
||||
|
||||
Morse::Morse(const GpioClass & pin, const unsigned int ms) noexcept : unit (ms), led (pin),
|
||||
|
|
Loading…
Reference in a new issue