Skip to content

Using unqualified swap() on two small_vectors calls an incorrect swap function #342

Description

@geza-herman

This program crashes for me (boost 1.90), during the destructor of small_vector:

#include <boost/container/small_vector.hpp>

int main() {
    boost::container::small_vector<int, 2> a{1, 11};
    boost::container::small_vector<int, 2> b{2, 22};

    swap(a, b);
}

Supposedly the problem is that swap calls boost::container::vector::swap (hidden friend), instead of a small_vector member function.

(Note: a.swap(b) works correctly)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions