In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to use the intelligent pointer in Craft 11". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Function prototype:
Shared_ptr& operator= (const shared_ptr& x) noexcept
Description:
Assign values to shared_ptr from existing pointers to share data management rights.
Code example:
Execution result:
From the output, you can see the ps and ps1 count, and the value of the pointer.
Note:
The declaration and assignment of the ps1 are performed in two stages, and only in this way will the assignment be performed. The following code looks like an assignment, but actually performs an initialization operation (constructor).
Mobile assignment
Function prototype:
Shared_ptr& operator= (shared_ptr&& x) noexcept
Description:
Assign values to shared_ptr from existing pointers, accompanied by the transfer of data management authority. The difference between a move assignment and a copy assignment is whether the parameter is a right value reference.
Code example:
Execution result:
From the output, you can see the ps and ps1 count, and the value of the pointer.
Note:
Although copying assignments does not cause memory leaks, in some scenarios, moving assignments can more accurately reflect the programmer's intentions and may release memory earlier.
The following code also performs a mobile assignment.
This is the end of the content of "how to use the Smart pointer in Category 11". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Public void swithWindowTest () {driver.findElement (By.className ("open")) .click ()
© 2024 shulou.com SLNews company. All rights reserved.