mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
bytecode_ptr updates
This commit is contained in:
parent
d9bac2bdb3
commit
5653fa55a1
@ -28,7 +28,8 @@
|
||||
|
||||
/**
|
||||
* \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
|
||||
@ -44,12 +45,14 @@
|
||||
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))
|
||||
@ -65,7 +68,7 @@ public:
|
||||
|
||||
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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user