python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
A function accepting a shared_ptr *or* a unique_ptr
I am trying to refactor some oldish code, and I want to use unique_ptrs for some objects where they are clearly suited. Up till now, shared_ptrs have been generally used.
Given that for most intents ...
Mike Sadler
Votes: 0
Answers: 1
Why std::shared_ptr doesn't work with base template classes?
First let me show you the inheritance structure:
template <class Type>
class Base {
public:
Base() {}
virtual bool verify() const = 0;
};
class Derived : public Base<int> {
publi...
German
Votes: 0
Answers: 1
How do I ensured all pointers are freed?
I have a class. Let's call it House. Houses of various properties are contained in a registry. Let's call this house registry. Within this class, I want to add a vector containing pointers to differen...
Onlyartist9
Votes: 0
Answers: 2
Why smart pointer type member variable can't be initialized at the declaring place in a class?
When I want to add a member variable with smart pointer type to a class, I found that it can't be initialized at the declaring place:
class Foo {
public:
std::shared_ptr<int> intSharedPtr = n...
Zhang Zheng
Votes: 0
Answers: 1