未验证 提交 ffeca2a2 编写于 作者: M Martin 提交者: GitHub

Change comparison to use int instead of double (#1758)

This allows the example to remain simple well not misleading a beginner
such a comparison is safe. Including an epsilon comparison or something
similar would overly complicate this example.
Co-authored-by: NMartin O'Shea <martin.oshea@native-instruments.com>
上级 1caef9a7
......@@ -13945,10 +13945,10 @@ Although `cached_computation` works perfectly in a single-threaded environment,
##### Example, good
struct ComputationCache {
double cached_x = 0.0;
int cached_x = 0;
double cached_result = COMPUTATION_OF_ZERO;
double compute(double x) {
double compute(int x) {
if (cached_x != x) {
cached_x = x;
cached_result = computation(x);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册