python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
unique_ptr inside a variant. Is it safe to use?
Id like to ask, is safe having a variant like this?
struct A
{
unique_ptr<T> anything;
};
struct B
{
int x = 0;
int y = 0;
};
variant<A, B> myVar;
myVar = ... A object;
myVar ...
Juan JuezSarmiento
Votes: 0
Answers: 1
How can I use Unique_ptrs with an class object having std::function as argument in the constructor
Problem Description
We have 2 classes A and B. B has the following constructor:
B(std::function<std::unique_ptr<A>()> a)
I am trying to create a unique_ptr as in std::unique_ptr<B> ...

Hani Gotc
Votes: 0
Answers: 2
Passing around reference of structure is invalidated
I am not sure what is causing the error. I have created a workable substitute in the following code that replicates the problem I am facing. The code is self explanatory.
Here are the structure declar...
harman
Votes: 0
Answers: 1
Why an extra set of constructor/destructor call for std::make_unique?
Looks like std::make_unique is making extra copy(related post) while it is supposed to be more efficient. Below is a sample implementation with typical c++ polymorphic class architecture. The output m...
getsuha
Votes: 0
Answers: 2