diff --git a/src/util/list_fn.h b/src/util/list_fn.h index d989d31db..9ef5359d8 100644 --- a/src/util/list_fn.h +++ b/src/util/list_fn.h @@ -108,6 +108,8 @@ list append(list const & l1, list const & l2) { */ template list map(list const & l, F f) { + static_assert(std::is_same::type, T>::value, + "map: return type of f is not sxpr"); if (is_nil(l)) { return l; } else { @@ -120,6 +122,8 @@ list map(list const & l, F f) { */ template void for_each(list const & l, F f) { + static_assert(std::is_same::type, void>::value, + "for_each: return type of f is not void"); if (is_nil(l)) { return; } else { @@ -133,6 +137,8 @@ void for_each(list const & l, F f) { */ template bool compare(list const & l1, list const & l2, P p) { + static_assert(std::is_same::type, bool>::value, + "compare: return type of f is not bool"); auto it1 = l1.begin(); auto it2 = l2.begin(); auto end1 = l1.end();