This function is used to negate the given values i.e. to change the sign of the values. It changes the positive values to negative and vice-versa.
Note: Objects of this class can be used on standard algorithms such as transform.
transform(arr_begin, arr_end, arr2_begin, negate
Parameters: It accepts four parameters which are described below:
- arr_begin: It is the lower bound of the given array.
- arr_end: It is the upper bound of the given array.
- arr2_begin: It is the lower bound of the second array in which the modified values to be updated.
(): It is the function that is used to negate the values of the given array.
Return values: It returns the same values with the opposite sign.
Below is the implementation that shows the working of negate() function:
-5 -7 20 60 -50
- Function Overloading vs Function Overriding in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- div() function in C++
- log() function in C++
- exp() function C++
- fma() function in C++
- ios manipulators hex() function in C++
- map rend() function in C++ STL
- ios manipulators oct() function in C++
- map rbegin() function in C++ STL
- max() function for valarray in C++
- ios manipulators right() function in C++
- ios manipulators dec() function in C++
- isfinite() function in C++
- nearbyint() function in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.