Skip to main content

Questions tagged [smart-pointer]

For questions about the usage of the smart pointer construct.

-1 votes
1 answer
162 views

I'm wrestling with a design choice question here. I've got a class that needs a couple of semaphores. Semaphores are non-movable objects. Objects of this class however need to go into a vector (there'...
T.E.D.'s user avatar
  • 1,069
2 votes
1 answer
3k views

I'm making a basic platformer game. I have a Game class as well as Level class. The game object holds a pointer to the current Level object. A level currently has a std::vector of GameObject raw ...
Luke B's user avatar
  • 147
1 vote
2 answers
232 views

I s it possible to develop a distributed memory pointer in C++ by using operator overload? The idea would be that you pass ip address and port to the overloaded pointer *, &, and the pointer ...
hacker emzeze's user avatar
8 votes
2 answers
17k views

I've been out of C++ for years, last time I used it was back in gamedesign before C++11. I see all these new pointer types which seem great. But I'm unsure when and how to use them. In the old days I ...
Kevin's user avatar
  • 844
12 votes
4 answers
22k views

In my C++ project, I have three classes, Particle, Contact, and Network. The Network class will have N particles (std::vector<Particle> particles) and Nc contacts (std::vector<Contact> ...
AnInquiringMind's user avatar
1 vote
1 answer
4k views

I basically have the following situation: +------------------+ | | | Input object | ...
pluczak's user avatar
  • 13
1 vote
1 answer
1k views

I find myself often in the situation where I want to mock a non-copyable object, for example a DbHandle handle. I was going back and forth looking at different design choices, and I settled on the ...
user695652's user avatar
4 votes
1 answer
4k views

What is the correct initialisation of a smart pointer? std::unique_ptr<Class> ptr(std::make_unique<Class>()); or std::unique_ptr<Class> ptr = std::make_unique<Class>(); Is ...
bbalchev's user avatar
  • 594

15 30 50 per page