C ++中的新(int)(构造函数)语法是什么意思?

时间:2019-09-19 22:16:36

标签: c++

因此,我正在查看LLVM的Call指令代码,它具有如下的公共构造函数:

  static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
                          const Twine &NameStr,
                          Instruction *InsertBefore = nullptr) {
    return new (ComputeNumOperands(Args.size()))
        CallInst(Ty, Func, Args, None, NameStr, InsertBefore);
  }

Create调用适当的私有构造函数CallInst,但使用我不理解的整数。

这是ComputeNumOperands的代码,您可以看到它返回int

  /// Compute the number of operands to allocate.
  static int ComputeNumOperands(int NumArgs, int NumBundleInputs = 0) {
    // We need one operand for the called function, plus the input operand
    // counts provided.
    return 1 + NumArgs + NumBundleInputs;
  }

我的问题是:new int Constructor()是什么意思?

0 个答案:

没有答案