From a79d4e0d385c5639527e7cfeace32fc2d30714d4 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 18 Feb 2024 23:41:16 +0800 Subject: [PATCH] some fix --- include/pocketpy/expr.h | 11 ++++++++--- include/pocketpy/vector.h | 10 ---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/include/pocketpy/expr.h b/include/pocketpy/expr.h index 26b02ff0..cc0a28f1 100644 --- a/include/pocketpy/expr.h +++ b/include/pocketpy/expr.h @@ -21,7 +21,7 @@ public: unique_ptr_128(T* ptr): ptr(ptr) {} T* operator->() const { return ptr; } T* get() const { return ptr; } - T* release() { T* p = ptr; ptr = nullptr; return p; } + T* detach() { T* p = ptr; ptr = nullptr; return p; } unique_ptr_128(const unique_ptr_128&) = delete; unique_ptr_128& operator=(const unique_ptr_128&) = delete; @@ -32,14 +32,14 @@ public: ~unique_ptr_128(){ PK_POOL128_DELETE(ptr) } template - unique_ptr_128(unique_ptr_128&& other): ptr(other.release()) {} + unique_ptr_128(unique_ptr_128&& other): ptr(other.detach()) {} operator bool() const { return ptr != nullptr; } template unique_ptr_128& operator=(unique_ptr_128&& other) { PK_POOL128_DELETE(ptr) - ptr = other.release(); + ptr = other.detach(); return *this; } @@ -53,6 +53,11 @@ public: typedef unique_ptr_128 Expr_; typedef small_vector Expr_vector; +template<> +struct TriviallyRelocatable{ + constexpr static bool value = true; +}; + struct Expr{ int line = 0; virtual ~Expr() = default; diff --git a/include/pocketpy/vector.h b/include/pocketpy/vector.h index 53bde13c..01bf6adb 100644 --- a/include/pocketpy/vector.h +++ b/include/pocketpy/vector.h @@ -190,21 +190,11 @@ namespace pkpy { constexpr inline bool is_trivially_relocatable_v = TriviallyRelocatable::value; - template - struct TriviallyRelocatable>{ - constexpr static bool value = true; - }; - template struct TriviallyRelocatable>{ constexpr static bool value = true; }; - template - struct TriviallyRelocatable>{ - constexpr static bool value = true; - }; - template struct TriviallyRelocatable>{ constexpr static bool value = true;