parsing from std::string into a boost::string_view using boost::spirit::x3

心不动则不痛 提交于 2019-12-01 00:57:43

I'd simply write what you want:

v = boost::string_view(&*b, std::distance(b,e));

You might want to check that storage is contiguous¹ as a concept check for your input range. In that respect, it might be clearer to also require the iterator to be random-access, and write:

v = boost::string_view(&*b, e-b);

¹ this is a requirement for string_view anyways

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!