`wil::reg::try_get_value()` is gated by `_OPTIONAL_` and `__cpp_lib_optional`, but can't be re-included
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 300
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 1
Description
WIL has several features where the features available from <wil/feature.hpp> depend on which headers have already been included; for the majority of these, you can include the header again, but this doesn't work for <wil/registry.h> as the entire file is gated with a traditional include guard for __WIL_REGISTRY_INCLUDED
Concretely, given how other parts of WIL work, I would expect this to work but it does not:
#include <wil/registry.h> // << works if I delete this line
#include <optional>
#include <wil/registry.h>
// ...
auto x = wil::reg::try_get_value<T>(key, name);
This is problematic when other a different header includes <registry.h>.
Suggested fixes:
- use the same pattern you're using in other parts of WIL to allow re-inclusion
- alternatively/additionally, add support for 'tweak headers'
As an example of tweak headers, wil/registry.h could start with:
#if __has_include(<wil-reg.tweaks.h>)
#include <wil-reg.tweaks.h>
#endif
I could then make a wil-reg.tweaks.h be included in my build, and include <optional> in that header.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with wil/registry.h and compare its include-guard and feature-gating pattern with the re-inclusion behavior described for wil/feature.hpp. Reproduce the shown include order with and verify that wil::reg::try_get_value(key, name) is available. Done means the header supports the intended include order or an explicitly documented tweak-header configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100