/**
* \file
- * \brief bytecode_ptr: Smart pointer that knows its length and alignment.
+ * \brief bytecode_ptr: Smart pointer with unique ownership that knows its
+ * length and alignment.
*/
#ifndef UTIL_BYTECODE_PTR_H
namespace ue2 {
/**
- * \brief Smart pointer that knows its length and alignment.
+ * \brief Smart pointer that knows its length and alignment and behaves like a
+ * std::unique_ptr -- i.e. it retains unique ownership of the memory region.
*
* This is intended to be used for flat aligned memory regions that will
* eventually end up copied into the Hyperscan bytecode.
*/
-template<typename T> class bytecode_ptr : totally_ordered<bytecode_ptr<T>> {
+template<typename T>
+class bytecode_ptr : totally_ordered<bytecode_ptr<T>> {
public:
bytecode_ptr() = default;
explicit bytecode_ptr(size_t size, size_t align = alignof(T))
bytecode_ptr(std::nullptr_t) {}
- T *get() const { return ptr.get(); };
+ T *get() const { return ptr.get(); }
T &operator*() { return *ptr; }
const T &operator*() const { return *ptr; }