From 850d4ff05649d573847e26f689707041a99f5b39 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 31 Jul 2018 15:35:22 -0700 Subject: [PATCH] PVField::copyUnchecked assert() Field comparison is now O(0), so do this anyway to help catch mistakes. --- src/factory/PVField.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/factory/PVField.cpp b/src/factory/PVField.cpp index 8553eec..049ebe7 100644 --- a/src/factory/PVField.cpp +++ b/src/factory/PVField.cpp @@ -184,7 +184,7 @@ void PVField::copy(const PVField& from) if(isImmutable()) throw std::invalid_argument("destination is immutable"); - if (getField()->getType() != from.getField()->getType()) + if (getField() != from.getField()) throw std::invalid_argument("field types do not match"); copyUnchecked(from); @@ -192,6 +192,8 @@ void PVField::copy(const PVField& from) void PVField::copyUnchecked(const PVField& from) { + assert(getField()==from.getField()); + switch(getField()->getType()) { case scalar: