avoid lambda to simplify source code
This commit is contained in:
1 parent
6cd99768ae
commit
03dc8f2a13
6 files changed
+143
-126
No files matched your search
@@ -425,10 +425,14 @@ produce the `int64_t` alternative and unsigned definitions produce the `uint64_t
|
||||
alternative. Raw values remain exact across their full 64-bit ranges. Check
|
||||
`valid` before using the value; an invalid result's default value is not decoded data.
|
||||
|
||||
Use `std::get` when the numeric type is known, or `std::visit` to handle both:
|
||||
Use `std::get` when the numeric type is known, or `std::get_if` to handle both:
|
||||
|
||||
```cpp
|
||||
std::visit([] (auto raw) { std::cout << raw; }, decodedSignal.rawValue);
|
||||
if (const auto *value = std::get_if<std::int64_t>(&decodedSignal.rawValue)) {
|
||||
std::cout << *value;
|
||||
} else {
|
||||
std::cout << std::get<std::uint64_t>(decodedSignal.rawValue);
|
||||
}
|
||||
```
|
||||
|
||||
This replaces the previous `int64_t` field: consumers that read or print
|
||||
|
||||
Reference in new issue
Block a user