0CC-FamiTracker | Extension of jsr 's FamiTracker | Video Game library
kandi X-RAY | 0CC-FamiTracker Summary
kandi X-RAY | 0CC-FamiTracker Summary
Extension of jsr's FamiTracker
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of 0CC-FamiTracker
0CC-FamiTracker Key Features
0CC-FamiTracker Examples and Code Snippets
Community Discussions
Trending Discussions on 0CC-FamiTracker
QUESTION
The code at this GitHub file uses a C++ variable "declaration" syntax I'm not familiar with:
...ANSWER
Answered 2018-Jul-04 at 18:35It's not a declaration. It's an assignment to a temporary.
In std::unique_ptr {p} = std::make_unique(1);
, std::unique_ptr {p}
creates a unique_ptr
temporary that takes ownership of the object p
points to, then std::make_unique(1)
is assigned to that temporary, which causes the object p
points to to be deleted and the temporary to take ownership of the int
created by the make_unique
; finally, at the ;
, the temporary itself is destroyed, deleting the make_unique
-created int
.
The net result is delete p
plus a useless new/delete cycle.
(It would be a declaration had it used parentheses rather than braces:
std::unique_ptr (p) = std::make_unique(1);
is exactly equivalent to std::unique_ptr p = std::make_unique(1);
.)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install 0CC-FamiTracker
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page