Skip to content

🎨 Allow ct_strings in type_map - #425

Merged
bdeane-intel merged 1 commit into
intel:mainfrom
elbeno:type-map-allow-strings
Oct 8, 2026
Merged

bdeane-intel merged 1 commit into
intel:mainfrom
elbeno:type-map-allow-strings

Conversation

@elbeno

@elbeno elbeno commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Problem:

  • type_map does not easily allow pairs containing ct_string. This doesn't work:
using M = type_map<vt_pair<"A", X>, vt_pair<"B", Y>>;
  • type_map returns void or 0 on a miss, either of which might be valid entries.

Solution:

  • Allow ct_strings to be used as keys, values and defaults in type_map.
  • On a miss, return a missing_t type (or value of that type) by default.

Note:

Problem:
- `type_map` does not easily allow pairs containing `ct_string`. This doesn't
  work:

```cpp
using M = type_map<vt_pair<"A", X>, vt_pair<"B", Y>>;
```

- `type_map` returns `void` or `0` on a miss, either of which might be valid
  entries.

Solution:
- Allow `ct_string`s to be used as keys, values and defaults in `type_map`.
- On a miss, return a `missing_t` type (or value of that type) by default.

Note:
- This is a minor breaking change: downstream functions that check for `void` on
  a map lookup miss need to update. e.g. https://github.com/intel/compile-time-init-build/blob/main/include/interrupt/manager.hpp#L68
@bdeane-intel
bdeane-intel merged commit a13b2bb into intel:main Oct 8, 2026
27 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