search

Home  >  Q&A  >  body text

c++ - 如何进行逻辑关系判断

我想把逻辑关系存入表或者内存里以达到如下目的:
假设有三个返回值a,b,c,bool型,在不同位置,他们的逻辑关系不同,比如if(a&&b) 或者if(a&&b||c),我想达到自动读取逻辑关系进行操作,比如我现在有一个函数isApplicable(),它能抓取a,b,c的返回值,然后读取当前需要的逻辑关系,就可以用if(isApplicable()) 做一个通用方法了。

大家讲道理大家讲道理2805 days ago619

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 11:05:17

    Based on what you describe, implementing this general method has no real meaning in terms of syntax or performance.
    Even if you implement this function, you still need to define the "logical relationship" and pass it in as a parameter every time you call it, without any simplification.

    I don’t know what special considerations you have.

    reply
    0
  • Cancelreply