Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-01-04 10:08:25


> After I move the line 'using std namespace', the error still occurs.
> The error occurs in file date_time/time_duration.hpp, line 66.
> min_type minutes() const
> {
> return std::abs(((ticks() / (60*rep_type::res_adjust())) % 60));
> }
>

It seems like the abs function declared in boost/date_time/compiler_config.
hpp
will not be included due to the macro configuration. The relavant
code snippet
is:

//boost/date_time/compiler_config.hpp
//Work around compilers that don't have std::abs
#if (__GNUC__ <= 3)|| (defined(BOOST_MSVC) && _MSC_VER <= 1200)
# define BOOST_NO_LONG_LONG_ABS
#endif

#if defined(BOOST_NO_LONG_LONG_ABS)
namespace std
{
    template <typename T> // JDG [7/6/02 made a template]
    inline T abs(T x)
    {
      return x < 0 ? -x : x;
    }
}
#endif

You might try altering this so that the function will be defined.
Something like (line 22)

#if (__GNUC__ <= 3)|| defined(BOOST_MSVC)

should do the trick. The only thing is that past testing with
newer versions of MSVC did not require this so I'm a bit suprised
that this is needed. This will only work if the problem is that
the compiler is trying to convert the underlying type boost::int64_t
into a long or another type because it lacks a std::abs for
this type.

Jeff


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