0

Macのclang ++でC ++ 11リスト集合の初期化をコンパイルしようとしています。

#include <iostream>
#include <list>
#include <string>

using namespace std;
int main(int argc, char *argv[]) {
    list<string> aList = {"abc", "def", "xyz"};
}

これはコンパイルのためのコマンドです。

clang++-mp-3.1 -std=c++11 iterator.cpp

一致するコンストラクタ エラーが発生しませんでした。

iterator.cpp:7:23: error: no matching constructor for initialization of
  'std::list<string>'
std::list<string> aList = {"abc", "def", "xyz"};
                  ^       ~~~~~~~~~~~~~~~~~~~~~

XCodeでやってみた

clang -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

ポートからclang ++も試しました

clang++-mp-3.1 -v
clang version 3.1 (branches/release_31)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

同じ結果が得られました。何が間違っている可能性がありますか?

C++ 11 ラムダの clang のサポート

4

1 に答える 1