Skip to content

🎨 Allow conversion when reading a single value#166

Merged
bdeane-intel merged 1 commit into
intel:mainfrom
elbeno:read-convert
May 11, 2026
Merged

🎨 Allow conversion when reading a single value#166
bdeane-intel merged 1 commit into
intel:mainfrom
elbeno:read-convert

Conversation

@elbeno
Copy link
Copy Markdown
Contributor

@elbeno elbeno commented May 1, 2026

Problem:

  • When reading a register value, it's common to want to get (say) the std::uint32_t out directly, rather than having to write:
  read(grp / "reg"_r)
| then([] (auto spec) { return spec["reg"_r]; })

Solution:

  • Allow a template argument to read to do the conversion inside.
read<std::uint32_t>(grp / "reg"_r);

Problem:
- When reading a register value, it's common to want to get (say) the
  `std::uint32_t` out directly, rather than having to write:

```c++
  read(grp / "reg"_r)
| then([] (auto spec) { return spec["reg"_r]; })
```

Solution:
- Allow a template argument to `read` to do the conversion inside.

```c++
read<std::uint32_t>(grp / "reg"_r);
```
@bdeane-intel bdeane-intel merged commit 56601bb into intel:main May 11, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants