Opened 13 years ago

Closed 8 years ago

#642 closed Bugs (fixed)

operator<< for gregorian::date_duration not found

Reported by: zak-k Owned by: az_sw_dude
Milestone: Component: date_time
Version: None Severity: Problem
Keywords: Cc:


The operator<< for boost::gregorian::date_duration (aka
gregorian::days) is not found by name lookup. This
appears to be because:

* boost::gregorian::date_duration is a typedef to:

boost::gregorian::date_duration_rep >

   where boost::gregorian::date_duration_rep is a
typedef to boost::date_time::duration_traits_adapted

  (defined in date_time/gregorian/greg_duration.hpp)

* operator<< for boost::gregorian::date_duration) is
defined in the gregorian namespace

  (defined in date_time/gregorian/gregorian_io.hpp)

However, since only the typedef names are in the
gregorian namespace, argument-dependent lookup doesn't
 find it there unless you add:

  using gregorian::operator<<;

to your code, after which the operator works as expected.

This occurs for me using both gcc 3.4.5 and 4.0.3, and
both with Boost 1.33.1 and current CVS trunk.

A possible solution would be to either move the
definition of operator<< to the date_time namespace, or
pull it into that namespace with a using declaration.

I haven't checked all the other gregorian types, but
it's possible that similer problems exist.

Change History (3)

comment:1 Changed 10 years ago by Andrey Semashev

Severity: Showstopper

This is fixed in trunk now. The fix will go in 1.38 release. However, the similar problem may still be present for other gregorian types. This will have to be checked.

comment:2 Changed 10 years ago by Andrey Semashev

Severity: ShowstopperProblem

comment:3 Changed 8 years ago by Katie Chan

Resolution: Nonefixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.