如何解决用标准实施代替boost
什么是替代此方法的正确方法?
std::ostringstream buf;
std::for_each(bd.begin(),bd.end(),buf << boost::lambda::constant(" ") << boost::lambda::_1);
使用不使用boost的实现吗?这是我尝试过的:
std::string backspace("&nbps;");
std::ostringstream buf;
std::for_each(bd.begin(),buf << backspace << std::placeholders::_1);
第二个'
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::_Ph<1>' (or there is no acceptable conversion)
解决方法
import tkinter
import threading
import time
global msg
def gui():
root = tkinter.Tk()
box = tkinter.Text(width=90,height=30,font=("Lucida Console",10))
box.pack(pady=20)
box.insert(tkinter.END,msg) #this updated msg should be shown
box.configure(state=tkinter.DISABLED)
root.mainloop()
def loop():
global msg
for x in range(100):
msg = str(x)
time.sleep(1)
if __name__ == '__main__':
p1 = threading.Thread(target=gui)
p2 = threading.Thread(target=loop)
p1.start()
p2.start()
是一种奇妙的怪兽,它会将lambda反向移植到C ++ 03。与您的代码等效的是:
boost::lambda
...甚至:
std::ostringstream buf;
std::for_each(bd.begin(),bd.end(),[&](auto const &v) { buf << " " << v; });
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。