I have a std::share_ptr<player> players[N]
global fixed size array shared among k worker threads, loading / writing done atomicaly.
I need an alternative to std::share_ptr
, it's slow!
Asked
Active
Viewed 76 times
0

Balan Narcis
- 139
- 1
- 10
-
Please provide evidence and a use-case. A [mcve] would be nice. If you have done timings please post the code and compilation options. – Richard Critten Apr 24 '17 at 10:52
-
Do you mean `std::shared_ptr`? How is it slow? – Apr 24 '17 at 10:52
-
Ok, gonna post some code late this day, Thanks. – Balan Narcis Apr 24 '17 at 10:54
-
1It depends on what you want, you could try `boost::intrusive_ptr` , or you could [roll your own](http://stackoverflow.com/questions/7792011/alternative-to-boostshared-ptr-in-an-embedded-environment), also consider if you really need shared _ownership_, it doesn't seem like it from your example but we I guess we don't know what you really want this for. – George Apr 24 '17 at 10:54
-
you can try [this one](https://github.com/user1095108/generic/blob/master/lightptr.hpp). – user1095108 Apr 24 '17 at 11:00