I have declared the following in header file.
namespace G1
{
inline namespace V1
{
constexpr float getV();
}
}
In CPP file, I have defined the getV function as
constexpr float G1::V1::getV()
{
return 0.1f;
}
In the main I am using static_assert to compare the version as shown.
int main()
{
static_assert( G1::getV() == 1.0f, "Error"); // Please Ignore the way I am comparing the floats
return 0;
}
But when I compile the code, I am getting expression did not evaluate to a constant.
Am I doing anything wrong here? I am using VS2015. Thanks in advance
==instead of=to compare.mainfunction supposed to know whatgetV()returns?