От: | Programador | ||
Дата: | 14.08.09 12:22 | ||
Оценка: |
template <class T>
struct Tmp
{ T& that;
Tmp(T& t):that(t){}
template <class C> operator C();
};
template <class I>
Tmp<I> convert(I& i)
{ return Tmp<I>(i);
}
template <>
Tmp<int>::operator double ()
{ return that*2;
}
int main(int argc, char **argv)
{ int a=9;
double d=convert(a);