Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2003-06-23 08:31:30


Bugs item #759218, was opened at 2003-06-23 16:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=759218&group_id=7586

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Sergiy Yakovyn (ysv_)
Assigned to: Nobody/Anonymous (nobody)
Summary: Gregorian dates bugs

Initial Comment:
1. I read docs about boost::gregorian::date. It has the
accessor 'greg_ymd year_month_day() const', but I
can't find 'greg_ymd' type anywhere.

2. So I use date::ymd_type instead. All looks like except
the following:

Tools.h
==========================================
#ifndef TOOLS_H
#define TOOLS_H

#include <boost/date_time/gregorian/gregorian.hpp>
  
typedef boost::gregorian::date Date;
typedef boost::gregorian::date_period Period;

std::string DateToString(Date d);

#endif
==========================================

Tools.cpp
==========================================
#include <sstream>
#include <iomanip>
#include "Tools.h"

using namespace std;
using namespace boost::gregorian;

string DateToString(Date d)
{
  ostringstream os;
  int m=d.month();
  os<<setw(2)<<setfill('0')<<d.day()<<'/'<<
      setw(2)<<m<<'/'<<setw(4)<<d.year();
  return os.str();
}
==========================================
That's working perfectly! Now I slightly change code of
Tools.cpp (remove 'm' variable):
==========================================
#include <sstream>
#include <iomanip>
#include "Tools.h"

using namespace std;
using namespace boost::gregorian;

string DateToString(Date d)
{
  ostringstream os;
  os<<setw(2)<<setfill('0')<<d.day()<<'/'<<
      setw(2)<<d.month()<<'/'<<setw(4)<<d.year();
  return os.str();
}
==========================================
And my app crashes!!!

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=759218&group_id=7586

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


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