'Compilation error: "nested name specifier for declaration does not refer into a class, class template or class template partial specialization" [closed]

I have 2 files:

digest.hpp

template <typename T, typename = std::enable_if_t<std::is_base_of_v<DigestCreator, T>>>
class DigestHolder {
public:
    DigestHolder();
};
#include "digest.ipp" // Included here.

digest.ipp

template <typename T, std::enable_if_t<std::is_base_of_v<DigestCreator, T>>>
DigestHolder<T>::DigestHolder()
{};

The class is decleared in hpp file and defined in ipp file. The ipp file is included at the end of hpp file.

However, I get compilation error:

error: nested name specifier 'DigestHolder<T>::' for declaration does not refer into a class, class template or class template partial specialization
DigestHolder<T>::DigestHolder()

Can anyone help me with this issue?

I tried by modifying the hpp template declaration as below but no good result:

Attempt 1:

template<typename T, std::enable_if_t<std::is_base_of_v<DigestCreator, T>, std::nullptr_t> = nullptr> 
class DigestHolder {};

Attempt 2:

template<typename T, std::enable_if_t<std::is_base_of_v<DigestCreator, T>, bool> = true> 
class DigestHolder {};


Solution 1:[1]

The template has two parameters even though you provide a default for one of them.
You need to name the second parameter in order to refer to it in the definition, and you should not provide another default argument:

template <typename T, typename U>
DigestHolder<T, U>::DigestHolder() {}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 molbdnilo