src: restrict MaybeStackBuffer string helpers to text types#62564
Closed
anonrig wants to merge 1 commit intonodejs:mainfrom
Closed
src: restrict MaybeStackBuffer string helpers to text types#62564anonrig wants to merge 1 commit intonodejs:mainfrom
anonrig wants to merge 1 commit intonodejs:mainfrom
Conversation
jasnell
reviewed
Apr 2, 2026
|
|
||
| template <typename T> | ||
| using MaybeStackBufferStringType = | ||
| std::conditional_t<std::is_same_v<T, uint16_t>, char16_t, T>; |
Member
There was a problem hiding this comment.
This should just be a concept
template <typename T>
concept MaybeStackBufferStringLike =
std::is_same_v<T, char> || std::is_same_v<T, wchar_t> ||
std::is_same_v<T, char8_t> || std::is_same_v<T, char16_t> ||
std::is_same_v<T, char32_t> || std::is_same_v<T, uint16_t>;
// ...
template <MaybeStackBufferStringLike U = T,
typename Char = MaybeStackBufferStringType<U>>
Member
Member
Author
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62564 +/- ##
=======================================
Coverage 89.70% 89.70%
=======================================
Files 695 695
Lines 214213 214214 +1
Branches 41021 41024 +3
=======================================
+ Hits 192167 192169 +2
+ Misses 14113 14109 -4
- Partials 7933 7936 +3
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Limit MaybeStackBuffer::ToString() and ToStringView to textual element types so byte buffers do not instantiate std::basic_string[_view] on libc++.
This avoids the macOS/Xcode deprecation warning for
char_traits<unsigned char>while preserving existing string helper behavior for text buffers.uint16_tbuffers are mapped to char16_t for these conversions so UTF-16 call sites continue to work.