Is it somehow possible to separate the definition and declaration of a class-method with template arguments (especially used when using constexpr
functions) in distinct places? Because aren't "template arguments" like explicit specializations of template-functions?
Or is this situation tangled with the already well-discussed topics: Why can’t I separate the definition of my templates class from its declaration and put it inside a .cpp file?
Why can templates only be implemented in the header file?
E.g.: Header file "someHeader.h"
#include <iostream>
#pragma once
class cc
{
public:
cc()=default;
~cc()=default;
template<uint32 f_val2Check_u32>
constexpr uint32 isPowerOf2();
private:
};
Then the *.cpp file:
// cpp-file
#include "someHeader.h"
template<uint32 val>
constexpr uint32 cc::isPowerOf2()
{
return ((val&(val-1))==0);
}