This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/42242] vector::resize unnecessarily calls null constructor
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Dec 2009 18:30:51 -0000
- Subject: [Bug libstdc++/42242] vector::resize unnecessarily calls null constructor
- References: <bug-42242-6594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from redi at gcc dot gnu dot org 2009-12-01 18:30 -------
On second thoughts, it might be necessary to split it into two overloads for
C++1x, because this should work:
#include <vector>
struct moveable {
explicit moveable(int) { }
moveable(const moveable&) = delete;
moveable(moveable&&) { }
};
int main()
{
std::vector<moveable> v;
moveable m(0);
v.resize(1, m);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42242