在此示例中,如何将字符串传递给绑定的“处理程序”函数?
// MyClass.h
class MyClass {
public:
MyClass(ESP8266WebServer& server) : m_server(server);
void begin();
void handler(String path);
protected:
ESP8266WebServer& m_server;
};
// MyClass.cpp
...
void MyClass::begin() {
String edit = "/edit.htm";
m_server.on("/edit", HTTP_GET, std::bind(&MyClass::handleFileRead(edit), this));
...
我尝试的每一种方式都得到:
error: lvalue required as unary '&' operand