編譯器錯誤 C3482
'this' 在非靜態成員函式內只能做為 Lambda 擷取
您無法將 this
傳遞給靜態方法或全域函式中所宣告之 Lambda 運算式的擷取清單。
更正這個錯誤
將封入函式轉換成非靜態方法,或
從 Lambda 運算式的擷取清單中移除
this
指標。
範例
下列範例會產生 C3482:
// C3482.cpp
// compile with: /c
class C
{
public:
static void staticMethod()
{
[this] {}(); // C3482
}
};