ev-json-spaceship-pointer-001¶
| 字段 | 值 |
|---|---|
| 项目 | nlohmann/json |
| 固定 commit | 55f93686c015 |
| 路径 | include/nlohmann/detail/json_pointer.hpp |
| 行段 | L868-L872 |
| 特性 | 三路比较运算符 <=> |
| 许可证 | MIT |
| 代码来源 | 项目源码 |
| 级别 | manual |
| 审核 | zyuhao7 @ 2026-10-24 |
| 测试代码 | 否 |
| 发现方式 | tree-sitter |
用法¶
用 <=> 比较 JSON Pointer 的 token 序列
为什么典型¶
把三路比较直接委托给已有容器的 <=>,不手写六个关系运算符,语义与容器一致。
摘录¶
template<typename RefStringTypeRhs>
std::strong_ordering operator<=>(const json_pointer<RefStringTypeRhs>& rhs) const noexcept // *NOPAD*
{
return reference_tokens <=> rhs.reference_tokens; // *NOPAD*
}
备注¶
生产路径;仅在 JSON_HAS_THREE_WAY_COMPARISON 分支启用。