I was bored and came up with such hack (pseudocode):
1 struct proxy {
2 operator int(); // int function
3 operator double(); // double function
4
If you really mean something like this:
1 struct proxy {
2 operator long() { return refs.first; } // long has greater precision
3 operator double() { return refs.second; } // double has greater range
4 proxy( long const &, double const & );
5 pair< long const &, double const & > refs;
6 };
7
8 proxy function() {
9 return proxy( numeric_limits::max() + 1,
double( numeric_limits::max() ) );
10 }
11 int v = function(...);
12 double u = function(...);
Then yes, I think that's cool and I would count it as a hack.
If it works. I didn't test it at all.