Question 81
In C++11 smart pointers, which smart pointer breaks cyclic reference deadlocks between std::shared_ptr objects?
std::weak_ptr holds a non-owning reference to a shared_ptr object without incrementing its reference count.
In C++11 smart pointers, which smart pointer breaks cyclic reference deadlocks between std::shared_ptr objects?
std::weak_ptr holds a non-owning reference to a shared_ptr object without incrementing its reference count.
In C++11 smart pointers, which smart pointer allows SHARED reference-counted ownership of a heap object?
std::shared_ptr uses an internal reference counter; heap memory is freed when reference count reaches 0.
In Python, what is the output of evaluating '10 and 20' and '10 or 20'?
In Python, 'and' returns first falsy value or last truthy value (20); 'or' returns first truthy value (10).
What is RAII (Resource Acquisition Is Initialization) idiom in C++?
RAII ensures resources are acquired in constructors and released automatically in destructors upon stack unwind.
In C++, what does 'std::move()' do in move semantics (C++11)?
std::move does not itself move resources. It performs a cast that allows the object's move operations to be considered, after which the selected move constructor or assignment operator performs the transfer.