mirror of
https://github.com/triqs/dft_tools
synced 2024-12-27 23:03:51 +01:00
24 lines
387 B
C++
24 lines
387 B
C++
#include <iostream>
|
|
|
|
struct infty {};
|
|
|
|
template<typename T> struct wrap {
|
|
T x;
|
|
wrap(T const & x_): x(x_) {}
|
|
operator infty() const { return infty();}
|
|
operator T () const { return x;}
|
|
};
|
|
|
|
|
|
double g(infty) { return 3;}
|
|
double f(double) { return 30;}
|
|
|
|
int main() {
|
|
|
|
wrap<double> w(2);
|
|
std::cout << w +1 <<std::endl;
|
|
std::cout << g(w) <<std::endl;
|
|
std::cout << f(w) <<std::endl;
|
|
|
|
}
|