$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r75577 - in trunk: boost/chrono/io libs/chrono/example
From: vicente.botet_at_[hidden]
Date: 2011-11-20 13:32:49
Author: viboes
Date: 2011-11-20 13:32:48 EST (Sun, 20 Nov 2011)
New Revision: 75577
URL: http://svn.boost.org/trac/boost/changeset/75577
Log:
Chrono: removed put functions in duration_units/time_point_units facets and the OutputIterator parameters
Text files modified: 
   trunk/boost/chrono/io/duration_put.hpp     |    55 +++--                                   
   trunk/boost/chrono/io/duration_units.hpp   |   370 ++++++++++++++------------------------- 
   trunk/boost/chrono/io/time_point_put.hpp   |    69 +-----                                  
   trunk/boost/chrono/io/time_point_units.hpp |    88 --------                                
   trunk/libs/chrono/example/french.cpp       |     8                                         
   5 files changed, 197 insertions(+), 393 deletions(-)
Modified: trunk/boost/chrono/io/duration_put.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_put.hpp	(original)
+++ trunk/boost/chrono/io/duration_put.hpp	2011-11-20 13:32:48 EST (Sun, 20 Nov 2011)
@@ -42,6 +42,10 @@
        */
       typedef CharT char_type;
       /**
+       * Type of character string passed to member functions.
+       */
+      typedef std::basic_string<CharT> string_type;
+      /**
        * Type of iterator used to write in the character buffer.
        */
       typedef OutputIterator iter_type;
@@ -91,21 +95,21 @@
       iter_type put(iter_type s, std::ios_base& ios, char_type fill, duration<Rep, Period> const& d, const CharT* pattern,
           const CharT* pat_end) const
       {
-        if (std::has_facet<duration_units<CharT, OutputIterator> >(ios.getloc()))
+        if (std::has_facet<duration_units<CharT> >(ios.getloc()))
         {
-          duration_units<CharT, OutputIterator> const&facet = std::use_facet<duration_units<CharT, OutputIterator> >(
+          duration_units<CharT> const&facet = std::use_facet<duration_units<CharT> >(
               ios.getloc());
           return put(facet, s, ios, fill, d, pattern, pat_end);
         }
         else
         {
-          duration_units_default<CharT, OutputIterator> facet;
+          duration_units_default<CharT> facet;
           return put(facet, s, ios, fill, d, pattern, pat_end);
         }
       }
 
       template <typename Rep, typename Period>
-      iter_type put(duration_units<CharT, OutputIterator> const& units_facet, iter_type s, std::ios_base& ios, char_type fill,
+      iter_type put(duration_units<CharT> const& units_facet, iter_type s, std::ios_base& ios, char_type fill,
           duration<Rep, Period> const& d, const CharT* pattern, const CharT* pat_end) const
       {
 
@@ -129,16 +133,9 @@
             }
             case 'u':
             {
-              s = put_unit(units_facet, s, ios, d);
+              s = put_unit(units_facet, s, ios, fill, d);
               break;
             }
-              //                case 'x':
-              //                {
-              //                  std::basic_string<CharT> pat = units_facet.get_pattern();
-              //                  pattern = pat.data();
-              //                  pat_end = pattern + pat.size();
-              //                  break;
-              //                }
             default:
               BOOST_ASSERT(false && "Boost::Chrono internal error.");
               break;
@@ -165,16 +162,16 @@
       template <typename Rep, typename Period>
       iter_type put(iter_type s, std::ios_base& ios, char_type fill, duration<Rep, Period> const& d) const
       {
-        if (std::has_facet<duration_units<CharT, OutputIterator> >(ios.getloc()))
+        if (std::has_facet<duration_units<CharT> >(ios.getloc()))
         {
-          duration_units<CharT, OutputIterator> const&facet = std::use_facet<duration_units<CharT, OutputIterator> >(
+          duration_units<CharT> const&facet = std::use_facet<duration_units<CharT> >(
               ios.getloc());
           std::basic_string<CharT> str = facet.get_pattern();
           return put(facet, s, ios, fill, d, str.data(), str.data() + str.size());
         }
         else
         {
-          duration_units_default<CharT, OutputIterator> facet;
+          duration_units_default<CharT> facet;
           std::basic_string<CharT> str = facet.get_pattern();
           return put(facet, s, ios, fill, d, str.data(), str.data() + str.size());
         }
@@ -206,26 +203,38 @@
        * @Returns An iterator pointing immediately after the last character produced.
        */
       template <typename Rep, typename Period>
-      iter_type put_unit(iter_type s, std::ios_base& ios, duration<Rep, Period> const& d) const
+      iter_type put_unit(iter_type s, std::ios_base& ios, char_type fill, duration<Rep, Period> const& d) const
       {
-        if (std::has_facet<duration_units<CharT, OutputIterator> >(ios.getloc()))
+        if (std::has_facet<duration_units<CharT> >(ios.getloc()))
         {
-          duration_units<CharT, OutputIterator> const&facet = std::use_facet<duration_units<CharT, OutputIterator> >(
+          duration_units<CharT> const&facet = std::use_facet<duration_units<CharT> >(
               ios.getloc());
-          return put_unit(facet, s, ios, d);
+          return put_unit(facet, s, ios, fill, d);
         }
         else
         {
-          duration_units_default<CharT, OutputIterator> facet;
-          return put_unit(facet, s, ios, d);
+          duration_units_default<CharT> facet;
+          return put_unit(facet, s, ios, fill, d);
         }
       }
 
       template <typename Rep, typename Period>
-      iter_type put_unit(duration_units<CharT, OutputIterator> const& facet, iter_type s, std::ios_base& ios,
+      iter_type put_unit(duration_units<CharT> const& facet, iter_type s, std::ios_base& ios, char_type fill,
           duration<Rep, Period> const& d) const
       {
-        return facet.put_unit(s, ios, d);
+        if (facet.template is_named_unit<Period>()) {
+          string_type str = facet.get_unit(get_duration_style(ios), d);
+          std::copy(str.begin(), str.end(), s);
+        } else {
+          *s++ = CharT('[');
+          std::use_facet<std::num_put<CharT, iter_type> >(ios.getloc()).put(s, ios, fill, Period::num);
+          *s++ = CharT('/');
+          std::use_facet<std::num_put<CharT, iter_type> >(ios.getloc()).put(s, ios, fill, Period::den);
+          *s++ = CharT(']');
+          string_type str = facet.get_n_d_unit(get_duration_style(ios), d);
+          std::copy(str.begin(), str.end(), s);
+        }
+        return s;
       }
 
       /**
Modified: trunk/boost/chrono/io/duration_units.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_units.hpp	(original)
+++ trunk/boost/chrono/io/duration_units.hpp	2011-11-20 13:32:48 EST (Sun, 20 Nov 2011)
@@ -135,7 +135,7 @@
      * as the number of plural forms, the plural form associated to a duration,
      * the text associated to a plural form and a duration's period,
      */
-    template <typename CharT = char, class OutputIterator = std::ostreambuf_iterator<CharT> >
+    template <typename CharT = char>
     class duration_units: public std::locale::facet
     {
     public:
@@ -147,10 +147,6 @@
        * Type of character string passed to member functions.
        */
       typedef std::basic_string<CharT> string_type;
-      /**
-       * Type of iterator used to scan the character buffer.
-       */
-      typedef OutputIterator iter_type;
 
       static std::locale::id id;
 
@@ -159,59 +155,6 @@
       {
       }
 
-      /**
-       *
-       * @tparam Rep
-       * @tparam Period
-       * @Requires Rep must be explicitly convertible to int_least64_t.
-       * @Requires Period is named.
-       *
-       * @param s
-       * @param ios
-       * @param d
-       * @Effects puts the unit associated to the duration @c d in @c s taken in account the @c ios state flags.
-       * The implementation uses the non template virtual function do_put_unit as if
-       * @code
-       *   return do_put_unit(s, ios, get_duration_style(ios), Period(), int_least64_t(d.count()));
-       * @codeend
-       *
-       * where @get_duration_style gives the duration style associated to @ios.
-       * @return s
-       */
-      template <typename Rep, typename Period>
-      typename enable_if<detail::is_localizable<Period>, iter_type>::type put_unit(iter_type s, std::ios_base& ios,
-          duration<Rep, Period> const& d) const
-      {
-        return do_put_unit(s, ios, get_duration_style(ios), Period(), int_least64_t(d.count()));
-      }
-
-      /**
-       *
-       * @tparam Rep
-       * @tparam Period
-       * @Requires Rep must be explicitly convertible to int_least64_t.
-       * @Requires Period is not named, that is its textual representation is in the form [N/D].
-       *
-       * @param s
-       * @param ios
-       * @param d
-       * @Effects puts the unit associated to the duration @c d in @c s taken in account the @c ios state flags.
-       * The implementation uses the non template virtual function do_put_unit as if
-       * @code
-       *   return do_put_unit(s, ios, get_duration_style(ios), rt_ratio(Period()), int_least64_t(d.count()));
-       * @codeend
-       *
-       * where @get_duration_style gives the duration style associated to @ios and
-       * rt_ratio is a class that flats the template ration on a run-time ration so we can use it in virtual functions.
-       * @return s
-       */
-      template <typename Rep, typename Period>
-      typename disable_if<detail::is_localizable<Period>, iter_type>::type put_unit(iter_type s, std::ios_base& ios,
-          duration<Rep, Period> const& d) const
-      {
-        return do_put_unit(s, ios, get_duration_style(ios), rt_ratio(Period()), int_least64_t(d.count()));
-      }
-
       const string_type* get_n_d_prefix_units_start() const
       {
         return do_get_n_d_prefix_units_start();
@@ -247,6 +190,31 @@
       {
         return do_get_pattern();
       }
+      /**
+       *
+       * @return the unit associated to this duration.
+       */
+      template <typename Rep, typename Period>
+      string_type get_unit(duration_style::type style, duration<Rep, Period> const& d) const
+      {
+        return do_get_unit(style, rt_ratio(Period()), d.count());
+      }
+      /**
+       *
+       * @return the unit associated to this duration.
+       */
+      template <typename Rep, typename Period>
+      string_type get_n_d_unit(duration_style::type style, duration<Rep, Period> const& d) const
+      {
+        return do_get_n_d_unit(style, rt_ratio(Period()), d.count());
+      }
+
+      template <typename Period>
+      bool is_named_unit() const
+      {
+        return do_is_named_unit(rt_ratio(Period()));
+      }
+
 
     protected:
 
@@ -260,65 +228,27 @@
       virtual const string_type* do_get_prefix_units_end() const = 0;
       virtual bool do_match_n_d_prefix_unit(const string_type* k) const = 0;
       virtual bool do_match_prefix_unit(const string_type* k, rt_ratio& rt) const = 0;
-
-      // used for ouput
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, atto, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, femto, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, pico, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, nano, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, micro, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, milli, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, centi, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, deci, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, ratio<1> , int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, deca, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, hecto, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, kilo, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, mega, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, tera, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, peta, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, exa, int_least64_t) const = 0;
-      virtual iter_type
-          do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, rt_ratio, int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, ratio<60> , int_least64_t) const = 0;
-      virtual iter_type
-      do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, ratio<3600> , int_least64_t) const = 0;
+      virtual string_type do_get_n_d_unit(duration_style::type style, rt_ratio rt, intmax_t v) const = 0;
+      virtual string_type do_get_unit(duration_style::type style,rt_ratio rt, intmax_t v) const = 0;
+      virtual bool do_is_named_unit(rt_ratio rt) const =0;
 
     };
 
-    template <typename CharT, class OutputIterator>
-    std::locale::id duration_units<CharT, OutputIterator>::id;
+    template <typename CharT>
+    std::locale::id duration_units<CharT>::id;
 
     // This class is used to define the strings for the default English
-    template <typename CharT = char, class OutputIterator = std::ostreambuf_iterator<CharT> >
-    class duration_units_default: public duration_units<CharT, OutputIterator>
+    template <typename CharT = char>
+    class duration_units_default: public duration_units<CharT>
     {
       static const std::size_t pfs_ = 2;
 
     public:
       typedef CharT char_type;
       typedef std::basic_string<CharT> string_type;
-      typedef OutputIterator iter_type;
 
       explicit duration_units_default(size_t refs = 0) :
-        duration_units<CharT, OutputIterator> (refs)
+        duration_units<CharT> (refs)
       {
         string_type* it = n_d_prefix_units_;
         it = fill_units(it, ratio<1> ());
@@ -438,160 +368,134 @@
         return n_d_prefix_units_ + (pfs_ + 1);
       }
 
-      virtual const string_type* do_get_prefix_units_start() const
+      const string_type* do_get_prefix_units_start() const
       {
         return prefix_units_;
       }
-      virtual const string_type* do_get_prefix_units_end() const
+      const string_type* do_get_prefix_units_end() const
       {
         return prefix_units_ + 19 * (pfs_ + 1);
       }
 
-      virtual std::size_t do_get_plural_forms() const
-      {
-        return pfs_;
-      }
-
-      virtual std::size_t do_get_plural_form(int_least64_t value) const
+      bool do_is_named_unit(rt_ratio rt) const
       {
-        return (value == -1 || value == 1) ? 0 : 1;
-      }
-
-      string_type do_get_pattern() const
-      {
-        static const CharT t[] =
-        { '%', 'v', ' ', '%', 'u' };
-        static const string_type pattern(t, t + sizeof (t) / sizeof (t[0]));
+        if (rt.num==1) {
+          switch (rt.den)
+          {
+          case BOOST_RATIO_INTMAX_C(1):
+          case BOOST_RATIO_INTMAX_C(10):
+          case BOOST_RATIO_INTMAX_C(100):
+          case BOOST_RATIO_INTMAX_C(1000):
+          case BOOST_RATIO_INTMAX_C(1000000):
+          case BOOST_RATIO_INTMAX_C(1000000000):
+          case BOOST_RATIO_INTMAX_C(1000000000000):
+          case BOOST_RATIO_INTMAX_C(1000000000000000):
+          case BOOST_RATIO_INTMAX_C(1000000000000000000):
+            return true;
+          default:
+            return false;
+          }
+        } else if (rt.den==1) {
+          switch (rt.num)
+          {
+          case BOOST_RATIO_INTMAX_C(10):
+          case BOOST_RATIO_INTMAX_C(60):
+          case BOOST_RATIO_INTMAX_C(100):
+          case BOOST_RATIO_INTMAX_C(1000):
+          case BOOST_RATIO_INTMAX_C(3600):
+          case BOOST_RATIO_INTMAX_C(1000000):
+          case BOOST_RATIO_INTMAX_C(1000000000):
+          case BOOST_RATIO_INTMAX_C(1000000000000):
+          case BOOST_RATIO_INTMAX_C(1000000000000000):
+          case BOOST_RATIO_INTMAX_C(1000000000000000000):
+            return true;
+          default:
+            return false;
+          }
+        }
+        return false;
 
-        return pattern;
       }
 
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, atto u, int_least64_t value) const
+      std::string do_get_n_d_unit(duration_style::type style, rt_ratio, intmax_t ) const
       {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, femto u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, pico u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
+        return do_get_plural_form(style, ratio<1>(), 1);
       }
+      std::string do_get_unit(duration_style::type style, rt_ratio rt, intmax_t v) const
+      {
+        if (rt.num==1) {
+          switch (rt.den)
+          {
+          case BOOST_RATIO_INTMAX_C(1):
+            return do_get_plural_form(style, ratio<1>(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(10):
+            return do_get_plural_form(style, deci(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(100):
+            return do_get_plural_form(style, centi(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(1000):
+            return do_get_plural_form(style, milli(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(1000000):
+            return do_get_plural_form(style, micro(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(1000000000):
+            return do_get_plural_form(style, nano(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(1000000000000):
+            return do_get_plural_form(style, pico(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(1000000000000000):
+            return do_get_plural_form(style, femto(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(1000000000000000000):
+            return do_get_plural_form(style, atto(), do_get_plural_form(v));
+          default:
+            ;
+          }
+        } else if (rt.den==1) {
+          switch (rt.num)
+          {
+          case BOOST_RATIO_INTMAX_C(10):
+             return do_get_plural_form(style, deca(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(60):
+            return do_get_plural_form(style, ratio<60>(), do_get_plural_form(v));
+          case BOOST_RATIO_INTMAX_C(100):
+             return do_get_plural_form(style, hecto(), do_get_plural_form(v));
+           case BOOST_RATIO_INTMAX_C(1000):
+             return do_get_plural_form(style, kilo(), do_get_plural_form(v));
+           case BOOST_RATIO_INTMAX_C(3600):
+             return do_get_plural_form(style, ratio<3600>(), do_get_plural_form(v));
+           case BOOST_RATIO_INTMAX_C(1000000):
+             return do_get_plural_form(style, mega(), do_get_plural_form(v));
+           case BOOST_RATIO_INTMAX_C(1000000000):
+             return do_get_plural_form(style, giga(), do_get_plural_form(v));
+           case BOOST_RATIO_INTMAX_C(1000000000000):
+             return do_get_plural_form(style, tera(), do_get_plural_form(v));
+           case BOOST_RATIO_INTMAX_C(1000000000000000):
+             return do_get_plural_form(style, peta(), do_get_plural_form(v));
+           case BOOST_RATIO_INTMAX_C(1000000000000000000):
+             return do_get_plural_form(style, exa(), do_get_plural_form(v));
+           default:
+             ;
+           }
+        }
 
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, nano u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, micro u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, milli u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, centi u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, deci u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base&, duration_style_type style, ratio<1> u, int_least64_t value) const
-      {
-        string_type str = do_get_plural_form(style, u, do_get_plural_form(value));
-        return std::copy(str.begin(), str.end(), s);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, deca u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, hecto u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
+        return "";
 
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, kilo u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, mega u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, giga u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, tera u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, peta u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
-      }
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, exa u, int_least64_t value) const
-      {
-        string_type str = do_get_ratio_prefix(style, u);
-        std::copy(str.begin(), str.end(), s);
-        return do_put_unit(s, ios, style, ratio<1> (), value);
       }
 
-      iter_type do_put_unit(iter_type s, std::ios_base&, duration_style_type style, ratio<60> u, int_least64_t value) const
+      virtual std::size_t do_get_plural_forms() const
       {
-        string_type str = do_get_plural_form(style, u, do_get_plural_form(value));
-        return std::copy(str.begin(), str.end(), s);
+        return pfs_;
       }
 
-      iter_type do_put_unit(iter_type s, std::ios_base&, duration_style_type style, ratio<3600> u, int_least64_t value) const
+      virtual std::size_t do_get_plural_form(int_least64_t value) const
       {
-        string_type str = do_get_plural_form(style, u, do_get_plural_form(value));
-        return std::copy(str.begin(), str.end(), s);
+        return (value == -1 || value == 1) ? 0 : 1;
       }
 
-      iter_type do_put_unit(iter_type s, std::ios_base& ios, duration_style_type style, rt_ratio rtr,
-          int_least64_t value) const
+      string_type do_get_pattern() const
       {
-        *s++ = CharT('[');
-        std::use_facet<std::num_put<CharT, iter_type> >(ios.getloc()).put(s, ios, ' ', rtr.num);
-        *s++ = CharT('/');
-        std::use_facet<std::num_put<CharT, iter_type> >(ios.getloc()).put(s, ios, ' ', rtr.den);
-        *s++ = CharT(']');
+        static const CharT t[] =
+        { '%', 'v', ' ', '%', 'u' };
+        static const string_type pattern(t, t + sizeof (t) / sizeof (t[0]));
 
-        return do_put_unit(s, ios, style, ratio<1> (), value);
+        return pattern;
       }
 
       string_type do_get_plural_form(duration_style_type style, ratio<1> , std::size_t pf) const
Modified: trunk/boost/chrono/io/time_point_put.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_put.hpp	(original)
+++ trunk/boost/chrono/io/time_point_put.hpp	2011-11-20 13:32:48 EST (Sun, 20 Nov 2011)
@@ -43,6 +43,10 @@
        */
       typedef CharT char_type;
       /**
+       * Type of character string passed to member functions.
+       */
+      typedef std::basic_string<CharT> string_type;
+      /**
        * Type of iterator used to write in the character buffer.
        */
       typedef OutputIterator iter_type;
@@ -93,21 +97,21 @@
       iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point<Clock, Duration> const& tp, const CharT* pattern,
           const CharT* pat_end) const
       {
-        if (std::has_facet<time_point_units<CharT, OutputIterator> >(ios.getloc()))
+        if (std::has_facet<time_point_units<CharT> >(ios.getloc()))
         {
-          time_point_units<CharT, OutputIterator> const &facet =
-              std::use_facet<time_point_units<CharT, OutputIterator> >(ios.getloc());
+          time_point_units<CharT> const &facet =
+              std::use_facet<time_point_units<CharT> >(ios.getloc());
           return put(facet, i, ios, fill, tp, pattern, pat_end);
         }
         else
         {
-          time_point_units_default<CharT, OutputIterator> facet;
+          time_point_units_default<CharT> facet;
           return put(facet, i, ios, fill, tp, pattern, pat_end);
         }
       }
 
       template <class Clock, class Duration>
-      iter_type put(time_point_units<CharT, OutputIterator> const& units_facet, iter_type s, std::ios_base& ios, char_type fill,
+      iter_type put(time_point_units<CharT> const& units_facet, iter_type s, std::ios_base& ios, char_type fill,
           time_point<Clock, Duration> const& tp, const CharT* pattern, const CharT* pat_end) const
       {
 
@@ -134,13 +138,6 @@
               s = put_epoch<Clock> (units_facet, s, ios);
               break;
             }
-              //                case 'x':
-              //                {
-              //                  std::basic_string<CharT> pat = units_facet.get_pattern();
-              //                  pattern = pat.data();
-              //                  pat_end = pattern + pat.size();
-              //                  break;
-              //                }
             default:
               BOOST_ASSERT(false && "Boost::Chrono internal error.");
               break;
@@ -167,53 +164,21 @@
       template <class Clock, class Duration>
       iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point<Clock, Duration> const& tp) const
       {
-        if (std::has_facet<time_point_units<CharT, OutputIterator> >(ios.getloc()))
+        if (std::has_facet<time_point_units<CharT> >(ios.getloc()))
         {
-          time_point_units<CharT, OutputIterator> const &facet =
-              std::use_facet<time_point_units<CharT, OutputIterator> >(ios.getloc());
+          time_point_units<CharT> const &facet =
+              std::use_facet<time_point_units<CharT> >(ios.getloc());
           std::basic_string<CharT> str = facet.get_pattern();
           return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size());
         }
         else
         {
-          time_point_units_default<CharT, OutputIterator> facet;
+          time_point_units_default<CharT> facet;
           std::basic_string<CharT> str = facet.get_pattern();
           return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size());
         }
       }
 
-      //      /*
-      //       *
-      //       */
-      //
-      //      template <class Clock, class Duration>
-      //      iter_type put(iter_type s, std::ios_base& ios, time_point<Clock, Duration> const& tp, const CharT* pattern,
-      //          const CharT* pat_end) const
-      //      {
-      //        time_point_units<CharT,OutputIterator> const& units_facet = time_point_units<CharT,OutputIterator>::imbue_if_has_not(ios);
-      //
-      //        return s;
-      //      }
-
-      //      /**
-      //       *
-      //       * @param s an output stream iterator
-      //       * @param ios a reference to a ios_base
-      //       * @param d the duration
-      //       * @Effects imbue in @c ios the @c time_point_units_default facet if not already present.
-      //       * Retrieves Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if
-      //       * @code
-      //       *   return put(s, ios, d, str.data(), str.data() + str.size());
-      //       * @codeend
-      //       * @Returns An iterator pointing immediately after the last character produced.
-      //       */
-      //      template <class Duration>
-      //      iter_type put(iter_type s, std::ios_base& ios, time_point<system_clock, Duration> const& tp) const
-      //      {
-      //        std::basic_string<CharT> str = time_point_units<CharT,OutputIterator>::imbue_if_has_not(ios).get_date_time_pattern();
-      //        return put(s, ios, tp, str.data(), str.data() + str.size());
-      //      }
-
       /**
        *
        * @param s an output stream iterator
@@ -244,7 +209,7 @@
        * @param d the duration
        * @param pattern
        * @Effects imbue in @c ios the @c time_point_units_default facet if not already present.
-       * @Effects Calls std::use_facet<time_point_units<CharT,OutputIterator> >(ios.getloc()).put(s, ios, d).
+       * @Effects Calls std::use_facet<time_point_units<CharT> >(ios.getloc()).put(s, ios, d).
        * @Returns An iterator pointing immediately after the last character produced.
        */
 
@@ -264,9 +229,11 @@
       }
 
       template <typename Clock>
-      iter_type put_epoch(time_point_units<CharT, OutputIterator> const& facet, iter_type s, std::ios_base& ios) const
+      iter_type put_epoch(time_point_units<CharT> const& facet, iter_type s, std::ios_base&) const
       {
-        return facet.template put_epoch<Clock> (s, ios);
+        string_type str = facet.template get_epoch<Clock>();
+        std::copy(str.begin(), str.end(), s);
+        return s;
       }
 
       /**
Modified: trunk/boost/chrono/io/time_point_units.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_units.hpp	(original)
+++ trunk/boost/chrono/io/time_point_units.hpp	2011-11-20 13:32:48 EST (Sun, 20 Nov 2011)
@@ -29,7 +29,7 @@
      * @c time_point_units facet gives useful information about the time_point pattern,
      * the text associated to a time_point's epoch,
      */
-    template <typename CharT=char, class OutputIterator = std::ostreambuf_iterator<CharT> >
+    template <typename CharT=char>
     class time_point_units: public std::locale::facet
     {
     public:
@@ -37,10 +37,6 @@
        * Type of character the facet is instantiated on.
        */
       typedef CharT char_type;
-      /**
-       * Type of iterator used to scan the character buffer.
-       */
-      typedef OutputIterator iter_type;
 
       /**
        * Unique identifier for this type of facet.
@@ -64,22 +60,6 @@
       }
 
       /**
-       *
-       * @param s
-       * @param ios
-       * @Effects As if
-       * @code
-       * return do_put_epoch(s, ios, Clock());
-       * @endcode
-       * @return @ s
-       */
-      template <typename Clock>
-      iter_type put_epoch(iter_type s, std::ios_base& ios) const
-      {
-        return do_put_epoch(s, ios, Clock());
-      }
-
-      /**
        * @return the pattern to be used by default calling @c do_get_pattern().
        */
       std::basic_string<CharT> get_pattern() const
@@ -107,56 +87,35 @@
        */
       virtual std::basic_string<CharT> do_get_pattern() const=0;
 
-      /**
-       * Customization point for inserting the system_clock timepoint's epoch.
-       *
-       * @param s start of the output stream
-       * @param ios the associated ios_base
-       * @param c tag used to make it possible to override system_clock pattern.
-       * @return
-       */
-      virtual iter_type
-      do_put_epoch(iter_type s, std::ios_base& ios, system_clock) const = 0;
-      /**
-       *  customization point for getting the system_clock timepoint's epoch.
-       */
       virtual std::basic_string<CharT> do_get_epoch(system_clock) const=0;
 
-      virtual iter_type
-      do_put_epoch(iter_type s, std::ios_base& ios, steady_clock) const = 0;
       virtual std::basic_string<CharT> do_get_epoch(steady_clock) const=0;
 
 #if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
-      virtual iter_type do_put_epoch(iter_type s, std::ios_base& ios, process_real_cpu_clock c) const =0;
       virtual std::basic_string<CharT> do_get_epoch(process_real_cpu_clock) const=0;
-      virtual iter_type do_put_epoch(iter_type s, std::ios_base& ios, process_user_cpu_clock c) const =0;
       virtual std::basic_string<CharT> do_get_epoch(process_user_cpu_clock) const=0;
-      virtual iter_type do_put_epoch(iter_type s, std::ios_base& ios, process_system_cpu_clock c) const =0;
       virtual std::basic_string<CharT> do_get_epoch(process_system_cpu_clock) const=0;
-      virtual iter_type do_put_epoch(iter_type s, std::ios_base& ios, process_cpu_clock c) const =0;
       virtual std::basic_string<CharT> do_get_epoch(process_cpu_clock) const=0;
 #endif
 #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
-      virtual iter_type do_put_epoch(iter_type s, std::ios_base& ios, thread_clock c) const =0;
       virtual std::basic_string<CharT> do_get_epoch(thread_clock) const=0;
 #endif
 
     };
 
-    template <typename CharT, class OutputIterator>
-    std::locale::id time_point_units<CharT, OutputIterator>::id;
+    template <typename CharT>
+    std::locale::id time_point_units<CharT>::id;
 
 
     // This class is used to define the strings for the default English
-    template <typename CharT=char, class OutputIterator = std::ostreambuf_iterator<CharT> >
-    class time_point_units_default: public time_point_units<CharT, OutputIterator>
+    template <typename CharT=char>
+    class time_point_units_default: public time_point_units<CharT>
     {
     public:
       typedef CharT char_type;
-      typedef OutputIterator iter_type;
 
       explicit time_point_units_default(size_t refs = 0) :
-        time_point_units<CharT, OutputIterator> (refs)
+        time_point_units<CharT> (refs)
       {
       }
       ~time_point_units_default() {}
@@ -181,58 +140,28 @@
 //          }
 
 
-      iter_type do_put_epoch(iter_type s, std::ios_base& , system_clock c) const
-      {
-        std::basic_string<CharT> str = do_get_epoch(c);
-        return std::copy(str.begin(), str.end(), s);
-      }
       std::basic_string<CharT> do_get_epoch(system_clock ) const
       {
         return clock_string<system_clock,CharT>::since();
       }
-      iter_type do_put_epoch(iter_type s, std::ios_base& , steady_clock c) const
-      {
-        std::basic_string<CharT> str = do_get_epoch(c);
-        return std::copy(str.begin(), str.end(), s);
-      }
       std::basic_string<CharT> do_get_epoch(steady_clock ) const
       {
         return clock_string<steady_clock,CharT>::since();
       }
 
 #if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
-      iter_type do_put_epoch(iter_type s, std::ios_base& , process_real_cpu_clock c) const
-      {
-        std::basic_string<CharT> str = do_get_epoch(c);
-        return std::copy(str.begin(), str.end(), s);
-      }
       std::basic_string<CharT> do_get_epoch(process_real_cpu_clock ) const
       {
         return clock_string<process_real_cpu_clock,CharT>::since();
       }
-      iter_type do_put_epoch(iter_type s, std::ios_base& , process_user_cpu_clock c) const
-      {
-        std::basic_string<CharT> str = do_get_epoch(c);
-        return std::copy(str.begin(), str.end(), s);
-      }
       std::basic_string<CharT> do_get_epoch(process_user_cpu_clock ) const
       {
         return clock_string<process_user_cpu_clock,CharT>::since();
       }
-      iter_type do_put_epoch(iter_type s, std::ios_base& , process_system_cpu_clock c) const
-      {
-        std::basic_string<CharT> str = do_get_epoch(c);
-        return std::copy(str.begin(), str.end(), s);
-      }
       std::basic_string<CharT> do_get_epoch(process_system_cpu_clock ) const
       {
         return clock_string<process_system_cpu_clock,CharT>::since();
       }
-      iter_type do_put_epoch(iter_type s, std::ios_base& , process_cpu_clock c) const
-      {
-        std::basic_string<CharT> str = do_get_epoch(c);
-        return std::copy(str.begin(), str.end(), s);
-      }
       std::basic_string<CharT> do_get_epoch(process_cpu_clock ) const
       {
         return clock_string<process_cpu_clock,CharT>::since();
@@ -240,11 +169,6 @@
 
 #endif
 #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
-      iter_type do_put_epoch(iter_type s, std::ios_base& , thread_clock c) const
-      {
-        std::basic_string<CharT> str = do_get_epoch(c);
-        return std::copy(str.begin(), str.end(), s);
-      }
       std::basic_string<CharT> do_get_epoch(thread_clock ) const
       {
         return clock_string<thread_clock,CharT>::since();
Modified: trunk/libs/chrono/example/french.cpp
==============================================================================
--- trunk/libs/chrono/example/french.cpp	(original)
+++ trunk/libs/chrono/example/french.cpp	2011-11-20 13:32:48 EST (Sun, 20 Nov 2011)
@@ -22,19 +22,19 @@
     using namespace boost;
     using namespace boost::chrono;
 
-    template <typename CharT=char, class OutputIterator = std::ostreambuf_iterator<CharT> >
-    class duration_units_fr: public duration_units_default<CharT, OutputIterator>
+    template <typename CharT=char>
+    class duration_units_fr: public duration_units_default<CharT>
     {
     public:
       typedef CharT char_type;
-      typedef OutputIterator iter_type;
 
       explicit duration_units_fr(size_t refs = 0) :
-        duration_units_default<CharT, OutputIterator>(refs)
+        duration_units_default<CharT>(refs)
       {
       }
     protected:
 
+      using duration_units_default<CharT>::do_get_plural_form;
       std::size_t do_get_plural_form(boost::int_least64_t value) const
       {
         return (value == -1 || value == 0 || value == 1) ? 0 : 1;