clamp:将一个值或一系列值限制在两个极端之间

时间:2021-07-20 09:31:14
【文件属性】:
文件名称:clamp:将一个值或一系列值限制在两个极端之间
文件大小:17KB
文件格式:ZIP
更新时间:2021-07-20 09:31:14
C++ 钳位算法 一种简单的算法,用于限制一个值或一系列值落在两个极端之间。 clamp已经提出用于C ++ 下文档号码库 。 将值限制在两个极端之间的代码可以通过各种伪装来实现。 从我们在(很久)前发现的正常情况来看: int clampedValue = value; if ( value < minValue xss=removed> maxValue ) clampedValue = maxValue; 通过: const int clampedValue = std::min( std::max( value, minValue ), maxValue ); 至: const int clampedValue = clamp( value, minValue, max
【文件预览】:
clamp-master
----.travis.yml(698B)
----test_util.hpp(2KB)
----std14.hpp(2KB)
----test_clamp.cpp(9KB)
----compile_g++.bat(68B)
----Copyright.txt(383B)
----compile_vc.bat(50B)
----lest.hpp(36KB)
----.gitignore(126B)
----Makefile(397B)
----README.md(3KB)
----clamp.hpp(2KB)

网友评论