fix: 收紧 streamable fallback jsonization<T> 的 requires#12
Open
weinibuliu wants to merge 1 commit intomasterfrom
Open
fix: 收紧 streamable fallback jsonization<T> 的 requires#12weinibuliu wants to merge 1 commit intomasterfrom
weinibuliu wants to merge 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
- 由于这个回退逻辑现在依赖多个
json::_utils类型萃取(type traits),建议提取出一个具名 concept(例如streamable_non_json_type),以便集中约束逻辑,并在这些 traits 在其他地方发生变化时,降低行为不一致的风险。 - 在公共头文件中使用内部的
json::_utilstraits 会加深对实现细节的耦合;如果可能的话,更推荐使用对外公开的 traits,或者包一层薄的 concept 封装,从而避免在 API 表面暴露内部的辅助工具。
面向 AI Agents 的提示
Please address the comments from this code review:
## Overall Comments
- Since this fallback now depends on multiple json::_utils type traits, consider extracting a named concept (e.g., `streamable_non_json_type`) to centralize the constraint logic and reduce the risk of divergence if these traits change elsewhere.
- Using internal `json::_utils` traits in a public header can tighten coupling to implementation details; if possible, prefer public-facing traits or a thin wrapper concept to avoid exposing internal helpers in the API surface.帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈改进之后的代码审查。
Original comment in English
Hey - I've left some high level feedback:
- Since this fallback now depends on multiple json::_utils type traits, consider extracting a named concept (e.g.,
streamable_non_json_type) to centralize the constraint logic and reduce the risk of divergence if these traits change elsewhere. - Using internal
json::_utilstraits in a public header can tighten coupling to implementation details; if possible, prefer public-facing traits or a thin wrapper concept to avoid exposing internal helpers in the API surface.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Since this fallback now depends on multiple json::_utils type traits, consider extracting a named concept (e.g., `streamable_non_json_type`) to centralize the constraint logic and reduce the risk of divergence if these traits change elsewhere.
- Using internal `json::_utils` traits in a public header can tighten coupling to implementation details; if possible, prefer public-facing traits or a thin wrapper concept to avoid exposing internal helpers in the API surface.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
neko-para
requested changes
Mar 20, 2026
|
|
||
| template <has_output_operator T> | ||
| requires(!std::is_constructible_v<json::value, T> && !std::is_constructible_v<json::array, T> && !std::is_constructible_v<json::object, T>) | ||
| requires( |
Contributor
There was a problem hiding this comment.
按理说应该能命中is_constructible_v<json::array, T>吧, 先看看为啥没命中?
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.
Summary by Sourcery
Bug Fixes:
T已经匹配内建的 JSON 值、数组、对象,或经工具检测为集合/元组/map/可空类型/variant 等类别时,避免为可流式输出类型选择jsonization<T>。Original summary in English
Summary by Sourcery
Bug Fixes: