2017-08-13 38 views
0

我只是想學拉姆達 的一些特點試過這裏提供通用拉姆達的Xcode 8.3.3

How does generic lambda work in C++14?

auto glambda = [](auto a) { return a; }; 

的例子之一,但我不知道出於某種原因Xcode的抱怨它

auto not allowed in lambda parameter

汽車不是所有拉姆達參數

1)我丟失的東西在安裝或庫

會理解的理由欠任何停機投票

+0

你能在項目設置C++ 14?上面的代碼爲我編譯。 – combinatorial

+0

@combinatorial任何具體的事情要做..你是否這樣做 –

+1

https://stackoverflow.com/questions/33358313/cant-get-c14-using-xcode-7-0-1 – WindyFields

回答

1

選擇在Xcode左側面板項目。然後選擇Build Settings選項卡。在右上角的篩選器中鍵入「C++語言」。然後將方言的設置更改爲C++ 14或GNU ++ 14。

Where to change the compiler setting to enable C++14

+0

偉大的工作非常感謝。我認爲你的答案對像我這樣的xcode的新用戶更有幫助。有更多的信息,然後https://stackoverflow.com/questions/33358313/cant-get-c14-using-xcode-7-0-1 –