当 min 被定义为宏时如何调用 std::min()?

How to call std::min() when min has been defined as a macro?(当 min 被定义为宏时如何调用 std::min()?)

本文介绍了当 min 被定义为宏时如何调用 std::min()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

min 已经被定义为宏时,如何调用 std::min?

How do I call std::min when min has already been defined as a macro?

推荐答案

(std::min)(x,y)

min 周围的括号防止宏扩展.这适用于所有函数宏.

The parentheses around min prevent macro expansion. This works with all function macros.

这篇关于当 min 被定义为宏时如何调用 std::min()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:当 min 被定义为宏时如何调用 std::min()?