Opened 16 years ago

Closed 12 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:

Description

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::date_time::date_duration<
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 by Andrey Semashev, 14 years ago

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 by Andrey Semashev, 14 years ago

Severity: ShowstopperProblem

comment:3 by Katie Chan, 12 years ago

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