Macro to make std::pair with fixed types
I'm trying to do something like this:
#define SOME_PAIR(x, y) std::make_pair<bool, std::string>(x, y)
So that what the programmer has to write is simply:
return SOME_PAIR(true, "Amazing");
But it looks like i'm doing something wrong, as 'no instance of function
template "std::make_pair" matches the argument list'.
What can i do to make this (or something similar to this) work?
Compiler: VC110 IDE: VS2012 OS: Win7x64
EDIT: The following code(thanks to jxh) makes it work perfectly:
#define SOME_PAIR(x, y) std::make_pair(bool(x), std::string(y))
And thus my lamda function ends up being really neat:
boot.init("log", [&](){
return INIT_PAIR(log.loaded, "Could not open log config file");
});
No comments:
Post a Comment