C++: Effective Modern C++(C++ 11, C++ 14) (guide,C Programming, HTML, Javascript, Programming,all,internet, Coding, CSS, Java, PHP Book 3) by Paul Laurence

C++: Effective Modern C++(C++ 11, C++ 14) (guide,C Programming, HTML, Javascript, Programming,all,internet, Coding, CSS, Java, PHP Book 3) by Paul Laurence

Author:Paul Laurence [Laurence, Paul]
Language: eng
Format: azw3
Published: 2017-10-28T04:00:00+00:00


You may notice that some of the results are confusing or mangled. This is because all of the threads happen to be competing for the same resource. This resource is stdout.

These jumbled results can be avoided by using mutexes or barriers. These barriers allow the developer the ability to organize how the threads will share a particular resource.

New Smart Pointer Classes

If you are unaware, smart pointers are currently defined within the std namespace in the memory header file. They are a key factor in the RAII. The RAII, which stands for the idiom Resource Acquisition Is Initialization, ensure that “ensure that resource acquisition occurs at the same time that the object is initialized”(MDSN).

A smart pointer is also a class template. This template is declared at stack level. It is initialized by pointing a raw pointer to an object allocated by a heap. After this is done, the smart pointer owns the raw pointer. The smart pointer now is accountable for any deletion of the memory that the raw pointer stipulates.

A previous version of C++, C++98, held a smart pointer class. This class was auto_ptr, which has since been depreciated. C++11 brings about 2 new smart pointer classes. This is shared_ptr and unique_ptr. Both of these new components are compatible with other components of the Standard library. The pointers can, therefore, be stored in standard containers and manipulated with standard algorithms.



Download



Copyright Disclaimer:
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.