In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how C++ uses const shared_ptr& type parameters". In daily operation, I believe many people have doubts about how C++ uses const shared_ptr& type parameters. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how C++ uses const shared_ptr& type parameters". Next, please follow the editor to study!
R.36: use the const shared_ptr& type parameter to indicate the reference count that may hold an object.
Reason (reason)
This makes the behavior of the function more explicit.
Example, good (sample)
Void share (shared_ptr); / / share-"will" retain refcount
Void reseat (shared_ptr&); / / "might" reseat ptr
Void may_share (const shared_ptr&); / / "might" retain refcountEnforcement (implementation recommendation)
(Simple) Warn if a function takes a Shared_pointer parameter by lvalue reference and does not either assign to it or call reset () on it on at least one code path. Suggest taking a T * or T & instead.
(simple) if a function uses the Shared_pointer parameter as a left reference, but does not assign a value to it or call reset () on any code path, warn and suggest using T* or T & instead.
(Simple) (Foundation) Warn if a function takes a Shared_pointer by value or by reference to const and does not copy or move it to another Shared_pointer on at least one code path. Suggest taking a T * or T & instead.
(simple) ((basic)) if a function uses the Shared_pointer parameter by passing a value or constant reference, but does not copy it or move it on any code path, issue a warning and suggest using T * or T & instead.
(Simple) (Foundation) Warn if a function takes a Shared_pointer by rvalue reference. Suggesting taking it by value instead.
(simple) ((basic)) if a function uses the Shared_pointer parameter with a right reference, it is recommended to pass a value instead.
At this point, the study of "how C++ uses const shared_ptr& type parameters" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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
© 2024 shulou.com SLNews company. All rights reserved.