I want to make integral constant from char* and \"kernel32.dll\", but failed always. The following are my failed attempts, anyone can show me the correct usage?
You may declare a static const char*
and use it in std::integral_constant
, something like:
static constexpr const char money[] = "money";
int main()
{
typedef void(*function_t)(int);
function_t ptrFunc =
delegate
::adapter<
&Class::print,
std::integral_constant >::invoke_no_fwd;
auto type = delegate::
adapter<&Class::print, std::integral_constant>::invoke_no_fwd;
ptrFunc(-42); // 0
type(0); // 42
return 0;
}
Live example
You may use something like in Aligning static string literals to allow to write the literal string in std::integral_constant
with a Macro.