feat(library/replace_using_ctx): add static_assert

This commit is contained in:
Soonho Kong 2013-10-01 16:45:36 -07:00
parent e3b762e909
commit 760f2e15ce

View file

@ -26,6 +26,10 @@ template<typename F, typename P = default_replace_postprocessor>
class replace_using_ctx_fn {
static_assert(std::is_same<typename std::result_of<F(expr const &, context const &, unsigned)>::type, expr>::value,
"replace_using_ctx_fn: return type of F is not expr");
// the return type of P()(e1, e2) should be void
static_assert(std::is_same<typename std::result_of<decltype(std::declval<P>())(expr const &, expr const &)>::type,
void>::value,
"The return type of P()(e1, e2) is not void");
typedef scoped_map<expr, expr, expr_hash, expr_eqp> cache;
cache m_cache;
F m_f;