Boost logo

Boost :

From: Roman Yakovenko (roman.yakovenko_at_[hidden])
Date: 2005-11-28 09:14:19


> > 2. Base class already has those operators, so why do you hide them?
>
> Unless I'm missing something the base class provides for
> comparison to other
> local times not ptimes:
>
> local_date_time l_time1(...), l_time2(...);
> if (ltime_1 == ltime_2) {...

1.

  template<class utc_time_=posix_time::ptime,
           class tz_type=date_time::time_zone_base<utc_time_> >
  class local_date_time_base : public date_time::base_time<utc_time_,
                                                            boost::posix_time::posix_time_system> {

2.

 template <class T, class time_system>
  class base_time : private
      boost::less_than_comparable<T
    , boost::equality_comparable<T
> >
  {
  public:
    typedef T time_type;

  //!Equality operator -- others generated by boost::equality_comparable
    bool operator==(const time_type& rhs) const
    {
      return time_system::is_equal(time_,rhs.time_);
    }
  

As you can see
date_time::base_time<utc_time_, boost::posix_time::posix_time_system> do provides
comparison operator for ptime.

> Jeff

Roman Yakovenko


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