2012-05-14から1日間の記事一覧

Boost.Xpressive のセマンティックアクションで整数を受け取る

as を使用します。 [ソース] #include <boost/xpressive/xpressive.hpp> #include <boost/xpressive/regex_actions.hpp> int main(){ namespace x = boost::xpressive; using x::_; int n = 0; x::sregex regex = ("(" >> (x::s1 = -*_) >> ")")[ x::ref(n) = x::as<int>(x::s1) ]; std::string const source = "(1234)"; if( x::rege…</int></boost/xpressive/regex_actions.hpp></boost/xpressive/xpressive.hpp>