[Bug libstdc++/42242] vector::resize unnecessarily calls null constructor

2009-12-01 Thread redi at gcc dot gnu dot org
--- Comment #1 from redi at gcc dot gnu dot org 2009-12-01 18:21 --- this is caused by the default argument to resize: void resize(size_type __new_size, value_type __x = value_type()); It would be possible to avoid the default construction by replacing that member with two overloads

[Bug libstdc++/42242] vector::resize unnecessarily calls null constructor

2009-12-01 Thread redi 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;

[Bug libstdc++/42242] vector::resize unnecessarily calls null constructor

2009-12-01 Thread pinskia at gcc dot gnu dot org
--- Comment #3 from pinskia at gcc dot gnu dot org 2009-12-01 18:33 --- (In reply to comment #1) It would be possible to avoid the default construction by replacing that member with two overloads of resize, but I'm not sure it's worth doing. The C++03 standard only lists the

[Bug libstdc++/42242] vector::resize unnecessarily calls null constructor

2009-12-01 Thread pinskia at gcc dot gnu dot org
--- Comment #4 from pinskia at gcc dot gnu dot org 2009-12-01 18:34 --- (In reply to comment #2) On second thoughts, it might be necessary to split it into two overloads for C++1x, because this should work: But std::vector::resize (size_type sz, T c = T()); is the only one listed at

[Bug libstdc++/42242] vector::resize unnecessarily calls null constructor

2009-12-01 Thread redi at gcc dot gnu dot org
--- Comment #5 from redi at gcc dot gnu dot org 2009-12-01 18:37 --- (In reply to comment #2) On second thoughts, it might be necessary to split it into two overloads for C++1x, because this should work: Gah, ignore that, I'm talking rubbish and that shouldn't work Andrew, the