VC11: map and unordered_map operater[] requires mapped_type to be CopyConstructible or MoveConstructible - by jhansw

Status : 


Sign in
to vote
ID 776500 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/14/2013 9:37:28 AM
Access Restriction Public


Here are the requirements for operater[] of std::map and std::unordered_map from the C++11 standard:

mapped_type& operator[](const key_type& k);
mapped_type& operator[](key_type&& k);

Requires: mapped_type shall be DefaultConstructible. For the first operator, key_type shall be CopyConstructible. For the second operator, key_type shall be MoveConstructible.

Note that it doesn't say that mapped_type shall be CopyConstructible or MoveConstructible, but the implementation in VC11 requires this.
Sign in to post a comment.
Posted by Deon [MSFT] on 4/29/2014 at 12:31 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from:
Posted by James [MSFT] on 2/11/2013 at 3:12 PM

Thank you for reporting this issue. We have fixed this bug and the fix will be present in the next version of the Visual C++ libraries. While we were investigating this bug, we also wrote extensive tests to verify that our container implementations are correct and adhere to the new C++11 fine-grained container requirements for value types; we found a number of other issues and fixes for those issues will also be present in the next version of the Visual C++ libraries.

If you do find further issues where the Visual C++ 2012 Standard Library containers do not conform to the C++11 fine-grained container requirements, please open another Connect bug or contact me directly, just so we can verify that we've fixed the issues.

Note: Connect doesn't notify me about comments. If you have any further questions, please e-mail me.

James McNellis
Visual C++ Libraries
Posted by Macy [MSFT] on 1/14/2013 at 10:21 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Macy [MSFT] on 1/14/2013 at 9:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(