python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
std::make_shared leads to undefined behavior, but new works
Consider the following example class:
class Foo {
public:
void* const arr_;
Foo() = delete;
Foo(const size_t size, bool high_precision) :
arr_(Initialize(size, high_precision)) ...
Hufh294
Votes: 0
Answers: 1
FreeRTOS Shared pointer parameter set to 0
I am trying to share data between 2 FreeRTOS tasks. My approach for this is to create a struct for the tasks' pvParameters that contains a std::shared_pointer.
My task creation looks like this:
au...

bleuj
Votes: 0
Answers: 0
Woes with std::shared_ptr<T>.use_counter()
https://en.cppreference.com/w/cpp/memory/shared_ptr/use_count states:
In multithreaded environment, the value returned by use_count is approximate (typical implementations use a memory_order_relaxed ...
Chris Rajula
Votes: 0
Answers: 2
Getting the Object Type from a Shared Pointer in C++
Is there a way to get the object type from a shared pointer? Suppose:
auto p = std::make_shared<std::string>("HELLO");
I want to get the string type from p i.e. something like:
p::ele...
Maths 4Us
Votes: 0
Answers: 2