0

I was looking for how to use YAML in LLVM. And I don't understand why they use empty templates. For example, here.

template <>
struct ScalarEnumerationTraits<FooBar> {
  static void enumeration(IO &io, FooBar &value) {
  ...
  }
};

What is the template <> for?

This is not a duplicate of What is the meaning of empty "<>" in template usage?.

1 Answers1

1

This is a template specialization. You will find somewhere something like:

template <typename C>
struct ScalarEnumerationTraits;

And the thing you are seeing is the specialisation of that declaration for the type FooBar.

Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175