c++11 - Compiler error reported for const vector<const T> in VS 2015 but not VS 2013 -
the following code compiles ok using visual studio 2013.
#include <vector> #include <string> int main() { const std::string conststring("fred"); const std::vector<const std::string> myvector{ conststring }; }
if try compile using visual studio 2015 following error reported:
1>xmemory0(587): error c2338: c++ standard forbids containers of const elements because allocator<const t> ill-formed.
i've seen various posts, , in particular 1 does c++11 allow vector<const t>?, vector<const t>
, why it's not allowed don't it. however, in above example vector const.
can please explain? vs 2013 wrong compile successfully?
Comments
Post a Comment