Message from C, C++ discussions
December 2019
— Likeprivate: TheFunc();
public:
void Func()
{
if constexpr (template_bool_param)
TheFunc();
else
:/ idk
}
Or based on this idea
void Func()
{
static_assert(t_bool_param,
"Func not defined"
);
TheFunc();
}
Or even more const's 😬
constexpr void Func()
{
static_assert(t_bool_param,
"Func not defined"
);
TheFunc();
}
— So I guess I'll implement a private function with a separate template parameter and use this, so that there is a block to write static_assert in it!
Hope the compiler to be happy with this
Thanks a lot! unterumarmung
— Hello guys
— Else is not obligatory, is it?
— Else the function should warn user that it doesn't exist
— Why isn't gnome-shell memory leak fixed yet 🤦🏻♀
I can't do anything because of that
— If you need a compiler error when you instantiate the template with a wrong type then static_cast
is a way to solve it
— Haven't used that, but the constexpr example i made works too right?
— Can't try anything yet btw.. 🙄
It's been more than 2~3 months ._.
— Guys, is it okay here if I asked someone to do my friend's code we'll pay him.
— Try