Skip to content

Instantly share code, notes, and snippets.

@Groogy
Last active July 16, 2017 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Groogy/ced66cee299e876ea39eec02ddca2839 to your computer and use it in GitHub Desktop.
Save Groogy/ced66cee299e876ea39eec02ddca2839 to your computer and use it in GitHub Desktop.
private macro do_math(operator, times)
self[{{SIZE - times}}].{{operator}}(other[{{SIZE - times}})]
{% if times != 0 %}
, do_math({{operator}}, {{times - 1}})
{% end %}
end
def +(other : Vector(Type, Size))
self.class.new(do_math(:+, SIZE))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment