Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core (LV::IntrusivePtr): Implement swap() overload as a friend function. #218

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

kaixiong
Copy link
Member

Overloading of functions in std namespace is considered undefined behaviour by the C++ standard.

We do the Right Thing by changing LV::IntrusivePtr's swap() to a friend function that can be found using argument-dependent lookup.

…on to work with ADL. Overloading std::swap() is considered UB!
@kaixiong kaixiong self-assigned this Jan 25, 2023
@kaixiong kaixiong added the bug label Jan 25, 2023
@kaixiong kaixiong added this to the 0.5.0_alpha1 milestone Jan 25, 2023
@kaixiong kaixiong merged commit 5f0d93c into master Jan 25, 2023
@kaixiong kaixiong deleted the c++-adl-swap branch January 25, 2023 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant