From 3e00139a873016be15c0912b41136d586c5ecd77 Mon Sep 17 00:00:00 2001 From: aothms Date: Mon, 5 Oct 2015 13:07:40 +0200 Subject: [PATCH] Add const pointer cast to IfcBaseClass --- src/ifcparse/IfcUtil.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ifcparse/IfcUtil.h b/src/ifcparse/IfcUtil.h index e57f5da279..3c10cd51b2 100644 --- a/src/ifcparse/IfcUtil.h +++ b/src/ifcparse/IfcUtil.h @@ -89,6 +89,13 @@ namespace IfcUtil { ? static_cast(this) : static_cast(0); } + + template + const T* as() const { + return is(T::Class()) + ? static_cast(this) + : static_cast(0); + } }; class IfcBaseEntity : public IfcBaseClass {