I have the following signature of a template:
// LoggingImpl.hpp
template <typename... Ts>
static void LogFatal(int32_t lineNumber, const char* function, const char* format, const Ts&... args) noexcept;
The definition of the function resides in the corresponding .cpp file:
// LoggingImpl.cpp
template <typename... Ts>
static void LoggingImpl::LogFatal(int32_t lineNumber, const char* function, const char* format, const Ts&... args) noexcept
{
// some function definition here.
}
The .cpp file also contains the explicit definition so that I do not get the linker error.
// LoggingImpl.cpp
template void LoggingImpl::LogFatal<char*>(int32_t, const char*, const char*, const char*) noexcept;
I am on a Win 10 machine, using visual studio 2019 compiling using MSVC.
Question: How can I have definition of the template function separated into the source (.cpp) file when my template contains variadic functions. I don't know how to add explicit signature when the template is for variadic arguments.