Boost logo

Boost :

From: Gabriel Dos Reis (Gabriel.Dos-Reis_at_[hidden])
Date: 2001-08-13 10:07:27


helmut.zeisel_at_[hidden] writes:

[...]

| A possible workaround for that problem could be
| to add some traits for rational_cast,
| e.g. by the following change in rational.hpp:

Or use a class helper

   namespace boost
   {
      template<typename To, typename Int>
      struct rational_cast_helper {
        static To do_it(/* ... */);
      };

      template<typename To, typename Int>
      To rational_cast(const rational<Int>& r)
      {
        return rational_cast_helper<To, Int>::do_it(r);
      }
   }

Now, you can (partially) specialize the cast engine.

-- Gaby


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk