码迷,mamicode.com
首页 > 编程语言 > 详细

Useful code snippets with C++ boost

时间:2017-07-22 14:37:42      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:should   end   std   sni   provides   like   ++   des   man   

Useful code snippets with C++ boost


Is Punctuation

It’s very straight forward to use boost.regex as a solution. We can match the input string with a regex like

if (boost::regex_match(",", boost::regex("[[:punct:]]"))) {
  std::cout << "is punctuation." << std::endl;
}

If the ICU is also in our consideration, code should be modified as

if (boost::u32regex_match("!", boost::make_u32regex("[[:P*:]]"))) {
  std::cout << "is unicode punctuation." << std::endl;
}

Argument Parser

Like optparse.OptionParser in Python, boost also provides a very nice command line arguments parser, in <boost/program_options.hpp>.

Useful code snippets with C++ boost

标签:should   end   std   sni   provides   like   ++   des   man   

原文地址:http://www.cnblogs.com/stevendes1/p/7221104.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!