当前位置:网站首页>See how names are added to namespace STD from cmath file

See how names are added to namespace STD from cmath file

2022-07-08 01:57:00 Haohong image algorithm

std by C++ Standard namespace in ,C++ There are all kinds of names in the standard library of .

The following is a standard namespace std Example .

#include <cmath>
#include <iostream>

using namespace std;

int main()
{
    
	float x = 3.6;
	int y = round(x);
	cout << "y is:" << y << endl << endl;


}

The operation results are as follows :
 Insert picture description here
In the code above , name round、cout、endl All are std Name in space .

Standard library math The function name in is also added to std In the space ,
file cmath Baidu online disk download link :
https://pan.baidu.com/s/1NZClfWR5ARG0WNdOOe0mZQ?pwd=wb7i

Let's take a look cmath How to put the document math The function name in is introduced into std In the space .
The screenshot is as follows :
 Insert picture description here
From the screenshot above, we can see , Introduce the name into std Space ,
The starting statement is :

_STD_BEGIN

If we want to put the name abs introduce std Space , Write like this :

using _CSTD abs;

Write the name you want to add , End as follows :
 Insert picture description here
As can be seen from the screenshot above , With

_STD_END

ending .

That's about it .

原网站

版权声明
本文为[Haohong image algorithm]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/189/202207072329378430.html