【发布时间】:2015-06-10 20:19:20
【问题描述】:
如果您单击相应的按钮,我正在尝试将引用变量 i_RootPath 的值设置为 while 循环内的不同值。编译不喜欢我分配 i_RootPath 的方式。它说:
没有可行的重载'='
如何在生成的按钮调用的不同方法中成功更改“i_RootPath”的值?
void NodeViewApp::AddToolbar( boost::filesystem::path& i_RootPath ) {
boost::filesystem::path currentPath = i_RootPath;
while( currentPath.has_root_path() ){
WPushButton* currentButton = new WPushButton( "myfile.txt" );
currentButton->clicked().connect( std::bind([=] () {
i_RootPath = currentPath;
}) );
currentPath = currentPath.parent_path();
}
}
【问题讨论】:
-
绑定看起来完全多余
标签: c++ boost boost-filesystem wt