Skip to content

feat(c++): make shared_ptr track ref by default#3214

Merged
chaokunyang merged 1 commit intoapache:mainfrom
chaokunyang:make_shared_ptr_track_ref_by_default
Jan 27, 2026
Merged

feat(c++): make shared_ptr track ref by default#3214
chaokunyang merged 1 commit intoapache:mainfrom
chaokunyang:make_shared_ptr_track_ref_by_default

Conversation

@chaokunyang
Copy link
Collaborator

@chaokunyang chaokunyang commented Jan 26, 2026

Why?

Make C++ shared ownership fields track references by default and extend ref tracking semantics to SharedWeak to match intended ownership behavior and reduce required annotations.

What does this PR do?

  • Make std::shared_ptr<T> (and fory::serialization::SharedWeak<T>) track refs by default in field metadata and serializers.
  • Extend smart-pointer detection and option validation to include SharedWeak<T> alongside shared_ptr/unique_ptr.
  • Update compile-time helpers, resolver logic, and tests to reflect the new default tracking behavior.
  • Refresh C++ and xlang docs to document defaults and valid options for SharedWeak.

Related issues

#2906

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

@chaokunyang chaokunyang merged commit 9b2a2ce into apache:main Jan 27, 2026
98 of 110 checks passed
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