What is the most efficient way to calculate the least common multiple of two integers?
I just came up with this, but it definitely leaves something to be desired.
C++ template. Compile time
#include
const int lhs = 8, rhs = 12;
template struct calc {
calc() { }
};
template struct calc {
calc() { std::cout << n << std::endl; }
};
template struct calc {
calc() { }
};
template struct calc {
calc() { }
};
template struct lcm {
lcm() {
lcm();
calc();
}
};
template<> struct lcm<0> {
lcm() {}
};
int main() {
lcm();
}