[Boost-bugs] [Boost C++ Libraries] #2811: date_time iostream dependencies

Subject: [Boost-bugs] [Boost C++ Libraries] #2811: date_time iostream dependencies
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-27 23:46:24


#2811: date_time iostream dependencies
-----------------------------------------------------------+----------------
 Reporter: Nigel T Stewart <nigels_at_[hidden]> | Owner: az_sw_dude
     Type: Feature Requests | Status: new
Milestone: Boost 1.39.0 | Component: date_time
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: iostream BOOST_NO_IOSTREAM _STLP_NO_IOSTREAMS |
-----------------------------------------------------------+----------------
 For footprint and performance reasons our codebase uses boost with
 BOOST_NO_IOSTREAM. However, date_time has some iostream dependency in the
 form of std::ostringstream used for formatting string outputs. For
 example, the method partial_date::to_string uses std::ostringstream to
 convert an integer to a string.

 An alternative is as follows:

 {{{
    //! Returns string suitable for use in POSIX time zone string
    /*! Returns string formatted with up to 3 digits:
     * Jan-01 == "0"
     * Feb-29 == "58"
     * Dec-31 == "365" */
    virtual std::string to_string() const
    {
      date_type d(2004, month_, day_);
      unsigned short c = d.day_of_year() - 1; // numbered 0-365 while
 day_of_year is 1 based...
      std::string ret;
      if (c/100) {
        ret += '0' + c/100;
        c = c%100;
      }
      if (c/10) {
        ret += '0' + c/10;
        c = c%10;
      }
      ret += '0' + c;
      return ret;
    }
 }}}

 Would you be likely to accept a patch that simply omits all the iostream-
 dependent API, if BOOST_NO_IOSTREAM is defined?

 Is there a boost-friendly alternative to std::ostringstream?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2811>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC