summaryrefslogtreecommitdiff
path: root/tmpl/factory_detail.tmpl.hpp
diff options
context:
space:
mode:
authorJosh Blum2013-07-27 19:20:35 -0700
committerJosh Blum2013-07-27 19:20:35 -0700
commita3b5a07cf7c64f1a038839d3ef2f7b1d9fbf6c42 (patch)
tree533568f9a549aeae63930b9767a582b4975629f2 /tmpl/factory_detail.tmpl.hpp
parent9ee559e8be429e6ca18858de668289cf66e19a0f (diff)
downloadsandhi-a3b5a07cf7c64f1a038839d3ef2f7b1d9fbf6c42.tar.gz
sandhi-a3b5a07cf7c64f1a038839d3ef2f7b1d9fbf6c42.tar.bz2
sandhi-a3b5a07cf7c64f1a038839d3ef2f7b1d9fbf6c42.zip
gras: added arg check with nice warning to callable and factory
Diffstat (limited to 'tmpl/factory_detail.tmpl.hpp')
-rw-r--r--tmpl/factory_detail.tmpl.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tmpl/factory_detail.tmpl.hpp b/tmpl/factory_detail.tmpl.hpp
index 87a0756..ea30235 100644
--- a/tmpl/factory_detail.tmpl.hpp
+++ b/tmpl/factory_detail.tmpl.hpp
@@ -16,6 +16,7 @@ struct GRAS_API FactoryRegistryEntry
FactoryRegistryEntry(void);
virtual ~FactoryRegistryEntry(void);
virtual Element *make(const PMCC &args) = 0;
+ void arg_check(const PMCList &args, const size_t nargs);
};
#for $NARGS in range($MAX_ARGS)
@@ -30,7 +31,7 @@ struct FactoryRegistryEntryImpl$(NARGS) : FactoryRegistryEntry
Element *make(const PMCC &args)
{
const PMCList &a = args.as<PMCList>();
- if (a.size() < $NARGS) throw a;
+ this->arg_check(a, $NARGS);
return _fcn($expand('a[%d].safe_as<A%d>()', $NARGS));
}
Fcn _fcn;