Skip to content

Add StrongTypedef to bn::base#8288

Merged
bdash merged 1 commit into
devfrom
test_strong_typedef
Jul 13, 2026
Merged

Add StrongTypedef to bn::base#8288
bdash merged 1 commit into
devfrom
test_strong_typedef

Conversation

@bdash

@bdash bdash commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Introduce bn::base::StrongTypedef<T, Tag, Mods...> that can be used to give a primitive type a distinct identity. The wrapped type is not implicitly convertible to or from its underlying type, but its value be accessed explicitly.

The operations available on the new type are opt-in through composable modifiers, such as Equality, Ordered, Hashable, Arithmetic, etc.

The intent is that over time we will move to using strong typedefs to represent instruction indexes, expression indexes, virtual addresses, etc., to prevent unintentionally using values of those types in the wrong contexts.

Introduce `bn::base::StrongTypedef<T, Tag, Mods...>` that can be used to give a
primitive type a distinct identity. The wrapped type is not implicitly convertible
to or from its underlying type, but its value be accessed explicitly.

The operations available on the new type are opt-in through composable modifiers,
such as `Equality`, `Ordered`, `Hashable`, `Arithmetic`, etc.
@bdash
bdash force-pushed the test_strong_typedef branch from 6a358d9 to 5f31dfa Compare July 13, 2026 15:00
@bdash
bdash merged commit 5f31dfa into dev Jul 13, 2026
5 checks passed
@bdash
bdash deleted the test_strong_typedef branch July 13, 2026 15:20
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.

1 participant