2014-09-03 48 views
1

我的環境:RadStudio XE4 UPDATE1上Windows7pro(32位)E2316使用的std ::功能

我試圖研究以下佔位符頁面 http://en.cppreference.com/w/cpp/utility/functional/placeholders

以下是代碼,我試圖編譯。

... 

#include <functional> 
#include <string> 
#include <iostream> 

... 

static void goodbye(const std::string &s) 
{ 
    std::cout << "Goodbye " << s << std::endl; 
} 

class Object { 
public: 
    void hello(const std::string &s) 
    { 
     std::cout << "Hello " << s << std::endl; 
    } 
}; 


void __fastcall TForm1::Button1Click(TObject *Sender) 
{ 
    // [bcc32 error] ...:E2316 'function' is not a member of 'std' 
    typedef std::function<void(const std::string &)> ExampleFunction; 
} 

在上面的代碼中,我得到了typedef語句中的E2316錯誤。

我應該怎麼做才能糾正這個錯誤?

回答

1

這在bcc32中不起作用。首先,bcc32不符合C++ 11標準,因此您必須使用boost::function

其次,bcc32不支持規格void(const std::string &)QC 126470)。

沒有解決方法。您必須完全放棄std::function的想法,並推出自己的解決方案(可能使用bcc32擴展__closure)。

它應該工作在bcc64。