Skip to content

[Refract] Use smart pointer in SpatialWeight#104

Open
HPDell wants to merge 8 commits intomasterfrom
feat/smart-ptr-simple
Open

[Refract] Use smart pointer in SpatialWeight#104
HPDell wants to merge 8 commits intomasterfrom
feat/smart-ptr-simple

Conversation

@HPDell
Copy link
Copy Markdown
Member

@HPDell HPDell commented Aug 12, 2025

改进了 SpatialWeight 类型的内存管理方式。

  • 使用 unique_ptr 即专属指针在 SpatialWeight 中存储 Weight 和 Distance 的指针,明确对象的所有权。
  • 通过 SpatialWeight 对象获取具体类型的 weight 或 distance 时,对外仅提供一个常量引用,而不是返回一个指针。避免外部意外释放内存。
  • IBandwidthSelectable 中的 criterion() 方法形参 weight 使用 const std::unique_ptr<BandwidthWeight>& 类型,明确所有权不转移。

@HPDell HPDell force-pushed the feat/smart-ptr-simple branch from d099eb7 to 818d8a2 Compare August 12, 2025 16:57
@HPDell HPDell force-pushed the feat/smart-ptr-simple branch from 818d8a2 to bdfa356 Compare April 26, 2026 06:35
@HPDell HPDell force-pushed the feat/smart-ptr-simple branch from aa144bd to 4a0f795 Compare April 29, 2026 10:32
@HPDell HPDell requested review from 977YSQ and WenNianshuo April 29, 2026 10:42
@HPDell HPDell assigned HPDell and unassigned HPDell Apr 29, 2026
@HPDell
Copy link
Copy Markdown
Member Author

HPDell commented Apr 29, 2026

@WenNianshuo @977YSQ 你们如果现在在负责这块的话,建议优先合并这个分支,以免留下太多历史包袱

@HPDell
Copy link
Copy Markdown
Member Author

HPDell commented Apr 29, 2026

这个分支还解决了之前有的时候某个测试会意外失败,再重新运行一次就通过的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant