Skip to content

Bug: vector swap overload resolution #17

@bivafra

Description

@bivafra

Problem

swap in the Vector is defined inside the class as a friend function. This enables ADL, that is, the function will be found through the unqualified swap(a, b) call. However, for the qualified call bmb::swap(a, b) the compiler will use general swap definition through moves.

Possible solution

Declare swap as a template friend function inside the Vector, then define it after the class definition. After that, the compiler will always choose proper swap version for both qualified and unqualified calls.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcontainerContainer related taskp2higher priority

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions