language: C++ 4.7.2 (gcc-4.7.2)
date: 263 days 10 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
 
template <class coefs>
double linear(double x) {
    return coefs::a * x  +  coefs::b;
}
 
struct my_coefs
{
    static const double a;
    static const double b;
};
 
const double my_coefs::a = 2.0;
const double my_coefs::b = 3.0;
 
int main()
{
    std::cout << linear<my_coefs>(5.0) << std::endl;
}