A dependent name is a name which is depends on a type with a template parameter. For example, if std::vector<T> is the type with template parameter T, then std::vector<T>::size_type is the dependent name. When using these names as type, we need to prefix them with typename .

For example,

template <typename T>
void somefunction()
{
    typename std::vector<T>::size_type value{0};
}

If we omit typename, this will give error for C++17 and less. It works without typename with C++20 onwards.

Tip

size_type is explained in this note.

References

  1. https://www.learncpp.com/cpp-tutorial/stdvector-and-the-unsigned-length-and-subscript-problem/