I would have thought this would be simple, but for some reason that won't compile on visual studio 2012. I'm not so much interested in discussing my reasons for doing this (I think the benefits are self evident) but would like to know why this isn't compiling... Thanks.
Sadly this still doesn't compile but I just figured out it's because MS C++ doesn't support user defined literals... back to plain old casting for me then...
Is there any way to emulate this behaviour using macros? So that I can still get this behaviour;
1 2 3 4 5 6 7 8 9
typedefdouble signalf;
typedeffloat physf;
//Some macro here that replaces any instance of "_sf" with nothing and every instance of "_pf" with "f"
signalf val1 = 1.234_sf; // this literal is "1.234" to the compiler and therefore double
physf val2 = 1.234_pf; // this literal is "1.234f" to the compiler and therefore float
This would be a nice intermediate solution because I could just swap the macro over for the literal overload and wouldn't have to wade through my entire program once Microsoft does implement user defined literals...