Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-08-23 14:02:13


Daniel Krügler wrote:
> Hello,
>
> After a short view at the rational.hpp header I propose to perform the
> following changes:

There will be at least one major change in boost.Rational soon, at which time
I'll probably make a few small changes, including addint a safe bool conversion
and cleaning up i/o.

> 1) As counterpart to the existing:
>
> bool operator!() const;
>
> one should definitly add:
>
> operator bool_replacement_type() const;
>
> with a proper (member function pointer) definition of
> bool_replacement_type.
>
> 2) The function template
>
> template <typename IntType>
> IntType lcm(IntType n, IntType m);
>
> should be defined as
>
> template <typename IntType>
> IntType lcm(IntType n, boost::call_traits<IntType>::param_type m);
>
> which makes sense in this case because m is not modified internally
> (in contrast to n)

I think lcm should be symmetrical.

> 3) The boost::rational IO should use proper templated extractors and
> inserters for those (most) compilers, which provide corresponding std
> IO libraries, such that
>
> #if defined (BOOST_NO_TEMPLATED_STREAMS)
> ... // current impl
> #else
>
> template<class CharType, class CharTrait, class IntType>
> inline std::basic_istream<CharType, CharTrait>&
> operator>>(std::basic_istream<CharType, CharTrait> &is,
> rational<IntType>&);
>
> template<class CharType, class CharTrait, class IntType>
> inline std::basic_ostream<CharType, CharTrait>&
> operator<<(std::basic_ostream<CharType, CharTrait> &os, const
> rational<IntType>&);
>
> #end
>
> Furtheron I propose to replace the helper class detail::resetter by
> boost::ios_flags_saver, or even better to remove it all all, because I
> assume, that the temporary unsetting of the skipws flag does not make
> much sense - Does it?
>
> I also propose to replace the current setting of ios_base::badbit (if
> widen('/') was not found) by the more appropriate setting of
> ios_base::failbit - This behaviour is in sync with std::complex and
> boost::tuple!

Sounds fine.

> Greetings from Bremen,
>
> Daniel Krügler

Greeting from ... Utah :(

Jonathan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net