Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class template special_values_formatter

boost::date_time::special_values_formatter — Class that provides generic formmatting ostream formatting for special values.


// In header: <boost/date_time/special_values_formatter.hpp>

template<typename CharT, 
         typename OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > > 
class special_values_formatter {
  // types
  typedef std::basic_string< CharT > string_type;    
  typedef CharT                      char_type;      
  typedef std::vector< string_type > collection_type;

  // construct/copy/destruct
  special_values_formatter(const char_type *const *, const char_type *const *);
  special_values_formatter(typename collection_type::iterator, 
                           typename collection_type::iterator);

  // public member functions
  OutItrT put_special(OutItrT, const boost::date_time::special_values &) const;
  static const char_type default_special_value_names;


This class provides for the formmating of special values to an output stream. In particular, it produces strings for the values of negative and positive infinity as well as not_a_date_time.

While not a facet, this class is used by the date and time facets for formatting special value types.

special_values_formatter public construct/copy/destruct

  1. special_values_formatter();

    Default strings are not-a-date-time -infinity +infinity

  2. special_values_formatter(const char_type *const * begin, 
                             const char_type *const * end);

    This constructor will take pair of iterators from an array of strings that represent the special values and copy them for use in formatting special values.

      const char* const special_value_names[]={"nadt","-inf","+inf" };
      special_value_formatter svf(&special_value_names[0], &special_value_names[3]);

  3. special_values_formatter(typename collection_type::iterator beg, 
                             typename collection_type::iterator end);

special_values_formatter public member functions

  1. OutItrT put_special(OutItrT next, 
                        const boost::date_time::special_values & value) const;