Closed kiselgra closed 7 years ago
User-space macro could look like this:
(defmacro for-each ((name container &key (iterator (gensym "ITERATOR"))) &body body)
`(for ((auto ,iterator = (funcall (oref ,container begin))) (!= ,iterator (funcall (oref ,container end))) (postfix++ ,iterator))
(decl ((auto ,name = (dref ,iterator)))
,@body)))
C-Mera currently does not support range-based iteration syntax.
As this is purely a syntactic extension I'm not entirely sure if we should even support it. We can easily define a macro for those cases.
However, supporting it would increase our coverage of C++ and probably be forthcoming to new users...
@lispbub What do you think?