Boost logo

Boost Users :

From: Daniel Krügler (dsp_at_[hidden])
Date: 2005-08-22 01:34:59


Hello,

After a short view at the rational.hpp header I propose to perform the
following changes:

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)

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!

Greetings from Bremen,

Daniel Krügler


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