Simplify the implementation of format and parse:

* For format, all a type must do is implement to_stream.

* For parse, each type X must specialize parse_manip<X,CharT,Traits>.
  Each specialization must include a public typedef to itself named
  type.

* Each parse_manip specialization must have a stream extraction
  operator.

* This commit depends on expression-SFINAE.  If this commit breaks
  your build, it is likely that your compiler/version does not
  support expression-SFINAE.  To fix this NO_EXPRESSION_SFINAE
  needs to be defined in the configuration area of date.h for
  that compiler/version.
This commit is contained in:
Howard Hinnant
2017-02-26 14:10:10 -05:00
parent ffc8cd0a3b
commit 1e7e7a214d
4 changed files with 513 additions and 942 deletions
+8
View File
@@ -390,6 +390,14 @@ test_F()
assert(!in.bad());
assert(tp == 2016_y/12/13);
}
{
std::istringstream in{"2016-12-13"};
year_month_day tp;
in >> parse("%F", tp);
assert(!in.fail());
assert(!in.bad());
assert(tp == 2016_y/12/13);
}
}
void