ev-json-ranges-borrowed-001¶
| 字段 | 值 |
|---|---|
| 项目 | nlohmann/json |
| 固定 commit | 55f93686c015 |
| 路径 | include/nlohmann/detail/iterators/iteration_proxy.hpp |
| 行段 | L232-L235 |
| 特性 | ranges 与 views |
| 许可证 | MIT |
| 代码来源 | 项目源码 |
| 级别 | manual |
| 审核 | zyuhao7 @ 2026-10-24 |
| 测试代码 | 否 |
| 发现方式 | regex |
用法¶
为迭代代理特化 enable_borrowed_range
为什么典型¶
显式告诉标准库该视图的迭代器可安全返回,是自定义视图接入 ranges 的关键定制点。
摘录¶
#if JSON_HAS_RANGES
template <typename IteratorType>
inline constexpr bool ::std::ranges::enable_borrowed_range<::nlohmann::detail::iteration_proxy<IteratorType>> = true;
#endif
备注¶
生产路径;由 JSON_HAS_RANGES 特性检测保护。