Skip to content

Conversation

@HPDell
Copy link
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
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.

2 participants