std :: min / std :: max with" intrinsic-like"

时间:2016-05-13 13:26:54

标签: c++ c++11

我正在重写一个库,其中一个"接口"是一个全局数字变量(不要问)。

我将UDT的全局对象替换为数字,支持PseudoInt x; // in library // in consumer void conumser() { int y = std::max(5, x); // will error now, because int and PseudoInt are not the same T }

我图书馆的一些内部消费者使用std :: max和全局。它们会出现编译错误,因为std :: max只需要一个T。

例如:

std::max<int>(5, x)

通过像grid1.Column("", header: "Edit", format: @<text>@Html.ActionLink("Edit", "EditEmployee", "BootStrap", new { id = item.empId,@onClick="EditEmployee()" }, new { target = "_blank" })</text>) 这样的事情,我最好像我的消费者一样不必做出反应。

我在这里运气不好吗?

1 个答案:

答案 0 :(得分:3)

由于[TestFixture] public class LogicTest { SharedTest st = new SharedTest(); [Test] st.RunAll(); } 是一个模板,因此您可以使用PseudoInt和Int为std::max提供专业化。

相关问题