I must admit I'm a bit lost with macros. I want to build a macro that does the following task and I'm not sure how to do it. I want to perform a scalar product of two arrays, say x and y, which have the same length N. The result I want to compute is of the form:
z = sum_{i=0}^{N-1} x[i] * y[i].
Run Code Online (Sandbox Code Playgroud)
x is const which elements are 0, 1, or -1 which are known at compile time, …
假设我有一个类,其中有一个带有一个参数的虚函数和该虚函数的两个不同实现。第一个实现使用该参数,而第二个实现则不使用该参数。第二种情况会产生编译警告。我可以想到两种方法来抑制警告。
[[maybe_unused]]注释。两者之间什么被认为是“最佳实践”?
预先感谢您的回答。