c – 在一行中创建一个带前缀的序列
发布时间:2020-12-16 10:52:14 所属栏目:百科 来源:网络整理
导读:给定初始化变量unsigned a,unsigned b with b a和std :: vector std :: string字符串大小为b-a.如何用字符串填充字符串,例如“x3”“x4”“x5”“x6”(在a = 3和b = 7的情况下)对于具有一个C命令的任意a和b(完全意味着一个分号:))? 解决方法 不太具挑战性…
给定初始化变量unsigned a,unsigned b with b> a和std :: vector< std :: string>字符串大小为b-a.如何用字符串填充字符串,例如“x3”“x4”“x5”“x6”(在a = 3和b = 7的情况下)对于具有一个C命令的任意a和b(完全意味着一个分号:))?
解决方法
不太具挑战性……
std::transform( boost::make_counting_iterator(a),boost::make_counting_iterator(b),strings.begin(),"x" + boost::lambda::bind(boost::lexical_cast<std::string,unsigned int>,boost::lambda::_1)); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |