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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -