1

I stumbled across the following:

template<> inline bool Value::GetValue<bool>() const {
    return m_Value.ValueBoolean();   // union
}

Can’t understand what the empty template declaration does ?

Kjell Gunnar
  • 2,947
  • 17
  • 22

2 Answers2

3

This is an explicit specialization of a template function for type bool. Explicit specialization is where template <> syntax is used.

template <typename T> void foo(T t) // Main template
{ 
  ... 
} 

template <> void foo<bool>(bool b) // Explicit specialization for type `bool`
{ 
  ... 
} 

The fact that in your example it is applied to a template of a class member function is completely inconsequential. The fact that the function is declared inline is also completely besides the point.

AnT
  • 302,239
  • 39
  • 506
  • 752
1

It is an explicit specialization.

robert
  • 3,313
  • 3
  • 31
  • 51