aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-27 19:49:45 -0800
committerChris Robinson <[email protected]>2018-11-27 19:49:45 -0800
commit0116e763ea22538b6cac2b78acc918185f54e2f9 (patch)
tree841cdaf6699776aacf7beedff1c18f40f3fa616a
parent21793884303edc4d5702b5a5fcd88a45c954028b (diff)
Add a unique_ptr alias for the ringbuffer
-rw-r--r--Alc/ringbuffer.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Alc/ringbuffer.h b/Alc/ringbuffer.h
index b516ab57..cb2077f8 100644
--- a/Alc/ringbuffer.h
+++ b/Alc/ringbuffer.h
@@ -3,6 +3,7 @@
#include <stddef.h>
+#include <memory>
#include <utility>
@@ -72,4 +73,11 @@ size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const void *src, size_t cnt);
/** Advance the write pointer `cnt' places. */
void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt);
+
+struct RingBufferDeleter {
+ void operator()(ll_ringbuffer_t *ring) const
+ { ll_ringbuffer_free(ring); }
+};
+using RingBufferPtr = std::unique_ptr<ll_ringbuffer_t,RingBufferDeleter>;
+
#endif /* RINGBUFFER_H */