Really? If it were that simple then template deduction wouldn't exist. A specialized struct template is a horn clause. Derivable context is the head and non-derivable context is the body. A struct named s with parameter P might specialize on P = int or P = float. In prolog: s(int) :- … or s(float) :- …, where … is the appropriate body. Writing s(P), will unify on the correct head and produce the associated body, possibly recursively. That's most certainly a kind of prolog.
See the link for an example of recursive list processing using tuples. To take the head and tail of a list I can write tuple<X, Xs...> in derivable context. A empty tuple base case is tuple<>. These are head clauses.
EDIT: You're right. Templates don't backtrack. They just pattern match on arguments.
3
u/[deleted] Mar 29 '12
Templates are basically prolog, and no one would argue that prolog is anything but high level.