C++ Recipes: A Problem-Solution Approach by Sutherland Bruce
Author:Sutherland, Bruce [Sutherland, Bruce]
Language: eng
Format: azw3
ISBN: 9781484201589
Publisher: Apress
Published: 2015-05-14T16:00:00+00:00
int GetNumber() const
{
return m_Number;
}
};
using UniqueMyClass = unique_ptr< MyClass >;
void CreateUniqueObject()
{
UniqueMyClass uniqueMyClass{ make_unique<MyClass>(10) };
}
int main(int argc, char* argv[])
{
cout << "Begin Main!" << endl;
CreateUniqueObject();
cout << "Back in Main!" << endl;
return 0;
}
The unique_ptr in Listing 10-10 is created inside a function to demonstrate that the instance of the dynamically created object is destroyed when the unique_ptr goes out of scope. You can see this reflected in the output in Figure 10-9.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8302)
Test-Driven Development with Java by Alan Mellor(6735)
Data Augmentation with Python by Duc Haba(6649)
Principles of Data Fabric by Sonia Mezzetta(6401)
Learn Blender Simulations the Right Way by Stephen Pearson(6300)
Microservices with Spring Boot 3 and Spring Cloud by Magnus Larsson(6172)
Hadoop in Practice by Alex Holmes(5959)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5808)
RPA Solution Architect's Handbook by Sachin Sahgal(5567)
Big Data Analysis with Python by Ivan Marin(5370)
The Infinite Retina by Robert Scoble Irena Cronin(5256)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5150)
Pretrain Vision and Large Language Models in Python by Emily Webber(4333)
Infrastructure as Code for Beginners by Russ McKendrick(4095)
Functional Programming in JavaScript by Mantyla Dan(4038)
The Age of Surveillance Capitalism by Shoshana Zuboff(3958)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3808)
Embracing Microservices Design by Ovais Mehboob Ahmed Khan Nabil Siddiqui and Timothy Oleson(3612)
Applied Machine Learning for Healthcare and Life Sciences Using AWS by Ujjwal Ratan(3583)
