English 中文(简体)
评价设置表达式
原标题:Evaluating set expressions
  • 时间:2012-05-22 06:39:19
  •  标签:
  • c++
  • c
  • set

我有一个将元素组织成非脱节组合的宇宙元素。 我有使用这些组合构建的表达式, 使用组合/ 交错/ 不同运算符。 因此, 如果给一个元素, 我需要评估这些表达式, 找出哪个“ 衍生” 组包含元素。 我不想计算“ 衍生” 组, 因为这个组会非常时间和空间效率不高 。 是否可以通过查看该组的表达式来判断该元素是否将存在于其中的一组中? 例如, 如果该表达式是 C = A U B, 而元素是 设置 A 中, 那么我可以说它将位于设置 C 中 。 有没有 C 库可以进行这种性质的计算?

最佳回答

if im not mistake, let e = the element

将每套 A、 B 替换为真实的, 如果 e 在集中, 如果没有的话是虚假的。 然后, 将设定的运算符转换为逻辑等值, 并将表达式评价为布林。 它应该全部对布林运算符, 甚至是 xor 等的东西进行映射 。

例如,e在两个AB中,但不在D中

C = (A U B) xor D

因为

    C = (true or true) xor false
->      (true)        xor false
-> true

如果你能很快找到一个元素是否在一组元素中,那可能很快。

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签