Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:55:54+00:00 2026-06-13T07:55:54+00:00

The following code doesn’t compile with clang 3.1, using libc++ (don’t know the version,

  • 0

The following code doesn’t compile with clang 3.1, using libc++ (don’t know the version, the current one that comes with Xcode). It works fine with other standard libs. Is there an error in my code, or is this a bug in libc++?

#include <map>
#include <string>
using namespace std;

struct A {
  A(const map<int, A>& m) {}
};

struct B {
  map<string, A> m;
};

The error i’m seeing is in <utility>:

/usr/lib/c++/v1/utility:241:64: No member named 'value' in 'std::__1::is_nothrow_copy_constructible<A>'

I’ve tried to isolate it further, but this is the minimal example I found. Interestingly, when I replace string by int in the second map it works (also when I replace int by string int the first map):

map<string, A> m; // Does not work
map<int, A> m; // Works
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:55:55+00:00Added an answer on June 13, 2026 at 7:55 am

    This is not exactly an error and I explain you why:

    In 1997, shortly before the C++ Standard was completed, the standardization committee received a query: Is it possible to create standard containers with incomplete types? It took a while for the committee to understand the question. What would such a thing even mean, and why on earth would you ever want to do it? The committee eventually worked it out and came up with an answer to the question. (Just so you don’t have to skip ahead to the end, the answer is “no.”) But the question is much more interesting than the answer: it points to a useful, and insufficiently discussed, programming technique. The standard library doesn’t directly support that technique, but the two can be made to coexist.

    When you are declaring const std::map<int, A>&, A is still incomplete and standard does not enforce implementers to provide support for incomplete types, so if you really need it and you have option to use boost, you can change your container and use boost::container in place of standard container in compilers that don’t support this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know why the following code doesn't compile: public class Main { public static
The following code doesn't compile for obvious reasons, namely that Foo is trying to
I've found that the following code doesn't compile in Visual Studio 2010 (but works
Short version: The following code doesn't compile: CComBSTR temp; CMenu().GetMenuString(0, temp, 0); but this
The following code doesn't work (of course), because the marked line does not compile:
Setting onchange event for CheckBoxList using the following code doesn't work. chkListUserGroup.Attributes.Add(onchange, document.forms[0].isRecordModified.value='true';); How
The following code doesn't compile. package varargspkg; public class Main { public static void
The following code doesn't compile ( error CS0123: No overload for 'System.Convert.ToString(object)' matches delegate
Does anyone know why the following code doesn't recognize ∙ as a valid infix
I am trying to delete a file, but the following code doesn't do that.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.