File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -151,8 +151,6 @@ template<typename T> class uninitialized {
151151 uninitialized& operator =(const uninitialized&) = delete ;
152152 uninitialized& operator =(uninitialized&&) = delete ;
153153
154- alignas ( T ) uint8_t data[sizeof ( T )];
155-
156154 template <typename ... Args> void construct (Args&&... args)
157155 {
158156 new (&data) T (std::forward<Args>(args)...);
@@ -173,6 +171,9 @@ template<typename T> class uninitialized {
173171 {
174172 return *reinterpret_cast <const T*>(&data);
175173 }
174+
175+ private:
176+ alignas ( T ) uint8_t data[sizeof ( T )];
176177};
177178
178179// std::make_unique is not available until C++14.
Original file line number Diff line number Diff line change @@ -222,13 +222,13 @@ namespace Audio {
222222 for (auto &loop : entityLoops) {
223223 loop.addedThisFrame = false ;
224224 // if we are the unique owner of a loop pointer, then it means it was stopped, free it.
225- if (loop.sound .unique () ) {
225+ if (loop.sound .use_count () == 1 ) {
226226 loop = {false , nullptr , -1 , -1 };
227227 }
228228 }
229229
230230 for (auto &stream : streams) {
231- if (stream and stream.unique () ) {
231+ if (stream and stream.use_count () == 1 ) {
232232 stream = nullptr ;
233233 }
234234 }
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ namespace Audio {
132132 emitter->Update ();
133133
134134 // No sound is using this emitter, destroy it
135- if (emitter.unique () ) {
135+ if (emitter.use_count () == 1 ) {
136136 emitter = nullptr ;
137137 }
138138 }
@@ -141,7 +141,7 @@ namespace Audio {
141141 (*it)->Update ();
142142
143143 // No sound is using this emitter, destroy it
144- if ((*it).unique () ) {
144+ if ((*it).use_count () == 1 ) {
145145 it = posEmitters.erase (it);
146146 } else {
147147 it ++;
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ namespace Resource {
287287 auto it = resources.begin ();
288288
289289 while (it != resources.end ()) {
290- if (not it->second ->keep and it->second .unique () ) {
290+ if (not it->second ->keep and it->second .use_count () == 1 ) {
291291 it->second ->Cleanup ();
292292 it = resources.erase (it);
293293 } else {
You can’t perform that action at this time.
0 commit comments