关于 C++ 中的 `abs` 相关函数

关于 C++ 中的 abs 相关函数

Lang:C

// defined in header <stdlib.h>
int abs(int n);
long labs(long n);
long long llabs(long long n); // from C99

Lang:C++

// defined in header <cstdlib>
// defined in header <cmath> (since C++17)
int std::abs(int n);
long std::abs(long n);
long long std::abs(long long n); // (since C++11)
long std::labs(long n);
long long std::llabs(long long n); // defined in header <cinttypes> (since C++11)
std::intmax_t abs(std::intmax_t n); // (since C++11)
std::intmax_t imaxabs(std::intmax_t n); // (since C++)

float std::abs(float arg);
double std::abs(double arg);
long double std::abs(long double arg);
float std::fabs(float arg);
float std::fabsf(float arg); // (since C++11)
double std::fabs(double arg);
long double std::fabs(long double arg);
long double std::fabsl(long double arg); // (since C++11)
double std::fabs(IntegralType arg); // (since C++11)

下次再不写 using namespace std; 也不写 std:: 我就。。

猜你喜欢

转载自www.cnblogs.com/Ryedii-blog/p/12444987.html