How to optimize code without repeating similar part, based on the type of input argument?

Make the arguments to GaussLine type parameters?

struct Element{A,B}
  name
  ...
end
function create_gauss_points(::Element{A,B}) where {A,B}
  gauss_line = GaussLine(A,B)
...
end
3 Likes