summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/slicer/modelParts.h2
-rw-r--r--slicer/test/compilation.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index 6e87fe6..664ef6c 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -183,6 +183,8 @@ namespace Slicer {
static const std::string & ToModelTypeName(const std::string &);
};
+ template<typename T> inline ModelPartPtr ModelPartFor(T & t) { return ModelPart::CreateFor(t); }
+
template<typename T>
class ModelPartForRoot : public ModelPart {
public:
diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp
index da13652..a985d7e 100644
--- a/slicer/test/compilation.cpp
+++ b/slicer/test/compilation.cpp
@@ -11,6 +11,9 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(std::type_info);
#define TypeTest(Var, Expr, Explicit, Expected) \
Var obj = Expr; \
+ Slicer::ModelPartPtr mppc = Slicer::ModelPartFor(obj); \
+ BOOST_REQUIRE_EQUAL(Slicer::Expected, mppc->GetType()); \
+ \
Slicer::ModelPartPtr mpp = Slicer::ModelPart::CreateFor(obj); \
BOOST_REQUIRE_EQUAL(Slicer::Expected, mpp->GetType()); \
\