Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-60798

QVector redundantly requires custom type's default constructor.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.8.0
    • None
    • Windows 10 64, MSVC 2015, Qt 5.8.0.

    Description

      Dear friends. First of all thank you for your great job.

      Now. This code compiles fine with std::vector:

      struct A
      {
        explicit A(int) {}
        A(const A&&) {}
        // Deleted:
        A() = delete;
        A(const A&) = delete;
        A& operator=(const A&) = delete;
      };
      
      int main()
      {
        std::vector<A> v;
        v.push_back(A(42));
        return 0;
      }
      

      But QVector requires A() and A(const A&) which I don't want to have (since they break my semantics and std::vector is quite happy without them).

      Related topic: http://stackoverflow.com/questions/33380402/what-is-the-reason-of-qvectors-requirement-for-default-constructor .

      Off topic: looks like QVector(int size, const T& value) solves this one: QTBUG-45488 .

      Best regards.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thiago Thiago Macieira
              some_username Dmitriy Goncharov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes