So I have this really ugly code:
template
std::conditional_t
As long as you understand the risk that the same sized type may not be the convertible, you could simply plugin a mpl::map..
typedef map<
pair, char>,
pair, short>,
pair, int>,
pair, long long>
> m;
e.g.
#include
#include
#include
#include
using namespace boost::mpl;
typedef map<
pair, char>,
pair, short>,
pair, int>,
pair, long long>
> m;
template
typename at>::type foo(T bar)
{ return reinterpret_cast(bar); }
struct doh
{
std::string a, b, c;
};
int main()
{
{
char c;
static_assert(std::is_same::value, "error");
}
{
short c;
static_assert(std::is_same::value, "error");
}
{
int c;
static_assert(std::is_same::value, "error");
}
{
long long c;
static_assert(std::is_same::value, "error");
}
{
double c;
static_assert(std::is_same::value, "error");
}
{
doh c;
static_assert(std::is_same::value, "error");
}
}