diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-21 22:10:22 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-21 22:10:22 +0200 |
commit | 595dfe169eb0ad0dbddf24cf3f94b954718b3cb5 (patch) | |
tree | 3ab65b55d3eb9c07437fa7361273364dd5d9fcf7 /c/episodelistview.cpp | |
parent | 4e03ae2fef20449de094baf52c5a8acf27a77adb (diff) | |
download | EpisodeBrowser-595dfe169eb0ad0dbddf24cf3f94b954718b3cb5.tar.gz |
Simplify OnTerminate.
No, not "awful", AWFUN!
Speaking of AWFUN, here is an alternative implementation of it:
#define AWFUN(t, f) cond_fun<t, f##A, f##W>
template <typename T, auto F, auto G>
std::enable_if_t<std::is_same_v<T, char>, decltype(F)> cond_fun = F;
template <auto F, auto G>
auto cond_fun<wchar_t, F, G> = G;
This implementation uses a variable template instead of a function
template, but I decided against it, as (at least I think) it would
instantiate useless variables that merely point to pre-existing API
functions. Like,
auto cond_fun__wchar_t__blablabla = MessageBoxW;
auto cond_fun__char__blablabla = MessageBoxA;
which is quite useless. Better to just have a constexpr function,
which the compiler may inline, return the real function pointer.
Diffstat (limited to 'c/episodelistview.cpp')
0 files changed, 0 insertions, 0 deletions