提升::精神(经典):|和^之间的区别?
boost::spirit (classic): difference between | and ^?
Doc 说(精神经典(:
a | b, Union, Match a or b. Also referred to as alternative
a ^ b, XOR, Match a or b, but not both.
当它很重要时,谁能给我举个实际的例子?
编辑:请给我实际的例子。创建规则,使用一些Actor,解析一些东西并向我展示差异。我知道OR和XOR是什么,但我看不出提升::精神结果之间有任何区别|和^。
std::string t;
boost::spirit::classic::rule<> r = ( ch_p( 'a' ) ^ ch_p( 'b' ) )[ assign_a( t ) ];
//boost::spirit::classic::rule<> r = ( ch_p( 'a' ) | ch_p( 'b' ) )[ assign_a( t ) ];
boost::spirit::classic::parse( "when it matters?", r );
boost::spirit
中的运算符^
(XOR(创建解析器的"独占或"组合。我没有得到它,因为我将主题放入 str_p/ch_p 解析器中。
感谢我从谁那里得到最好的例子@llonesmiz:
parse( "Z", alpha_p ^ xdigit_p );
相关文章:
- C++中std::resize(n)和std::shrink_to_fit之间的区别
- int(c) 和 c-'0' 之间的区别。C++
- C++ 使用 assign 函数的字符串与直接使用 '=' 更改值的字符串之间的区别
- std::atomic和std::condition_variable wait,notify_*方法之间的区别
- 我是C++编程的新手,这些代码之间有什么区别,我应该使用哪一个
- 在 const 函数中通过引用和指针返回之间的区别
- 我想知道长双倍和双倍之间的区别
- 这 4 个 lambda 表达式之间有什么区别?
- 结构体 S { int align; } 之间的区别;(struct 关键字后的名称)和 struct { int al
- (double) 和 double() 之间的区别
- & 和 * 之间的区别
- std::is_convertible 和 std::convertible_to 之间的区别(在实践中)?
- 析构函数和'delete'之间的区别
- 在 typedef 内部使用 const 关键字和在 typedef 外部使用 const 关键字之间有区别吗?
- 从预序遍历构造 bst 的 c++ 和 python 解决方案之间的区别
- vector.back() 和 vector[vector.size() - 1] 之间的区别?
- 空指针常量 (nullptr)、空指针值和空成员指针值之间有什么区别?
- 函数签名与调用的函数不匹配,常量字符[]和字符*之间的区别?
- OpenMP #pragma omp for v/s #pragma omp parallel for 之间的区别?
- S() 与 S{} 之间的区别?