C++ Deque operator=()C++ Deque operator=() function assigns new contents to the container and replacing the current content of same type. Size of the deque can be modified accordingly. SyntaxParameterx: It is a deque container whose content is to be copied into an another deque object. Return valueIt returns *this. Example 1Let's see a simple example Output: 1 2 3 4 5 In this example, operator=() assigns the content of 'a' container to 'b' container. Example 2Let's see a simple example when both the deques are of different type. Output: error: no matching function for call to 'std::deque<char>::operator=(std::deque<int>&)' In this example, type of 'a' and 'b' are different. Therefore, operator=() function throws an error. Next TopicC++ Deque |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India