In the boost::rational class, if I do
boost::rational<int> r(2,2);
std::cout << r << std::endl;
The result will be 1/1
. Is there a way to keep this as 2/2
without having to write a wrapper around the rational class? Ideally, I'd like this to apply to addition as well, so that something like
boost::rational<int> r(2,2);
boost::rational<int> s(2,2);
std::cout << r + s << std::endl;
would yield 4/2
instead of 2/1
Any help would be appreciated!