0

vector<const int>() fails to compile in C++14 (and in C++03).

Under C++03, we can say const int is not CopyAssignable, so naturally it fails.
However, under C++14, the wording in the standard is the requirement of T given vector<T>() depends on the relevant operation.

I searched the cppreference and the isoc++14 for the corresponding part, but didn't find the reason why const int fails here.

My question is, where in the standard mentions the requirement of T given vector<T>()?

M.M
  • 138,810
  • 21
  • 208
  • 365
FunkyBaby
  • 535
  • 3
  • 12
  • Have linked to an answer for C++11 -- AFAIK nothing changed between C++11 and C++14 – M.M Sep 23 '16 at 02:50
  • @M.M the last comment there says it's located under the allocator requirement, I checked the c++14 standard, there is no such clause as menetioned by that comment. – FunkyBaby Sep 23 '16 at 03:23
  • I'll see if I can add an answer to the other thread that includes the relevant references (and noting any changes between C++11 and C++14). The allocator parts are tough reading – M.M Sep 23 '16 at 04:50
  • @M.M magically enough, the one posted on year 2011 just updated that thread. – FunkyBaby Sep 23 '16 at 05:23
  • Fantastic, looks like Mr. Hinnant finally transferred his comment to an answer as suggested :) – M.M Sep 23 '16 at 06:21

0 Answers0