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
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- How to call some function before main() function in C++?
- Function Overloading vs Function Overriding in C++
- How to call function within function in C or C++
- What happens when a virtual function is called inside a non-virtual function in C++
- Difference between Virtual function and Pure virtual function in C++
- fma() function in C++
- div() function in C++
- exp() function C++
- log() function in C++
- map rbegin() function in C++ STL
- valarray exp() function in C++
- valarray log() function in C++
- valarray pow() function in C++
- valarray cos() function in C++
- valarray tan() 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 email@example.com. 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.