diff --git a/nautilus/include/nautilus/val_ptr.hpp b/nautilus/include/nautilus/val_ptr.hpp index 6083a5d3..19e71a7c 100644 --- a/nautilus/include/nautilus/val_ptr.hpp +++ b/nautilus/include/nautilus/val_ptr.hpp @@ -83,16 +83,18 @@ class base_ptr_val { base_ptr_val() : value() {}; #ifdef ENABLE_TRACING base_ptr_val(ValuePtrType ptr) : state(tracing::traceConstant((void*) ptr)), value(ptr) {}; -#else - base_ptr_val(ValuePtrType ptr) : value(ptr) {}; -#endif base_ptr_val(ValuePtrType ptr, tracing::value_ref tc) : state(tc), value(ptr) {}; base_ptr_val(ValuePtrType ptr, tracing::TypedValueRefHolder tc) : state(tc), value(ptr) {}; base_ptr_val(tracing::value_ref ref) : state(ref), value(nullptr) { } +#else + base_ptr_val(ValuePtrType ptr) : value(ptr) {}; +#endif +#ifdef ENABLE_TRACING tracing::TypedValueRefHolder state; +#endif ValuePtrType value; }; @@ -104,11 +106,20 @@ class val : public base_ptr_val { // enable cast to type T template operator val() const { +#ifdef ENABLE_TRACING return val((T*) this->value, this->state); +#else + return val((T*) this->value); +#endif } +#ifdef ENABLE_TRACING val(const val& otherValue) : base_ptr_val(otherValue.value, tracing::traceCopy(otherValue.state)) { } +#else + val(const val& otherValue) : base_ptr_val(otherValue.value) { + } +#endif val& operator=(const val& other) { #ifdef ENABLE_TRACING @@ -127,8 +138,13 @@ class val : public base_ptr_val { using base_ptr_val::base_ptr_val; using ValType = typename base_ptr_val::ValType; +#ifdef ENABLE_TRACING val(const val& otherValue) : base_ptr_val(otherValue.value, tracing::traceCopy(otherValue.state)) { } +#else + val(const val& otherValue) : base_ptr_val(otherValue.value) { + } +#endif val& operator=(const val& other) { #ifdef ENABLE_TRACING @@ -183,8 +199,13 @@ class val : public base_ptr_val { public: using base_ptr_val::base_ptr_val; +#ifdef ENABLE_TRACING val(const val& otherValue) : base_ptr_val(otherValue.value, tracing::traceCopy(otherValue.state)) { } +#else + val(const val& otherValue) : base_ptr_val(otherValue.value) { + } +#endif val& operator=(const val& other) { #ifdef ENABLE_TRACING