The previous code was right but unnecessarily hard to read. A block of code could
only be executed if an 'if' condition was true but wasn't actually under the
condition. Shift things.
((flags.cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
(flags.time != std::numeric_limits<double>::min() ? 1 : 0));
if (n_metadata > 0)
- out << "FIELD FieldData " << n_metadata << "\n";
-
- if (flags.cycle != std::numeric_limits<unsigned int>::min())
- {
- out << "CYCLE 1 1 int\n" << flags.cycle << "\n";
- }
- if (flags.time != std::numeric_limits<double>::min())
{
- out << "TIME 1 1 double\n" << flags.time << "\n";
+ out << "FIELD FieldData " << n_metadata << "\n";
+
+ if (flags.cycle != std::numeric_limits<unsigned int>::min())
+ {
+ out << "CYCLE 1 1 int\n" << flags.cycle << "\n";
+ }
+ if (flags.time != std::numeric_limits<double>::min())
+ {
+ out << "TIME 1 1 double\n" << flags.time << "\n";
+ }
}
}
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams