From fb5220a925a4a5b7e35d44413a8cfbe3319b005b Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 17 Jun 2023 13:30:52 +0800 Subject: [PATCH] ... --- src/expr.h | 4 +++- src/vector.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/expr.h b/src/expr.h index fd3d173d..98f218d1 100644 --- a/src/expr.h +++ b/src/expr.h @@ -36,7 +36,9 @@ struct Expr{ struct CodeEmitContext{ VM* vm; CodeObject_ co; - stack s_expr; + // some bugs on MSVC (error C2280) when using std::vector + // so we use stack_no_copy instead + stack_no_copy s_expr; int level; std::set global_names; CodeEmitContext(VM* vm, CodeObject_ co, int level): vm(vm), co(co), level(level) {} diff --git a/src/vector.h b/src/vector.h index 3ddac26b..549f4f71 100644 --- a/src/vector.h +++ b/src/vector.h @@ -141,4 +141,14 @@ public: Container& data() { return vec; } }; +template > +class stack_no_copy: public stack{ +public: + stack_no_copy() = default; + stack_no_copy(const stack_no_copy& other) = delete; + stack_no_copy& operator=(const stack_no_copy& other) = delete; + stack_no_copy(stack_no_copy&& other) noexcept = default; + stack_no_copy& operator=(stack_no_copy&& other) noexcept = default; +}; + } // namespace pkpy \ No newline at end of file