Simplify NonZero

This commit is contained in:
vitaut 2015-03-25 08:50:48 -07:00
parent 2ba3988da3
commit 885d1a1c64

View File

@ -700,16 +700,11 @@ void format_windows_error(fmt::Writer &out, int error_code,
fmt::StringRef message) FMT_NOEXCEPT;
#endif
// Computes max(Arg, 1) at compile time. It is used to avoid errors about
// Computes max(N, 1) at compile time. It is used to avoid errors about
// allocating an array of 0 size.
template <unsigned Arg>
template <unsigned N>
struct NonZero {
enum { VALUE = Arg };
};
template <>
struct NonZero<0> {
enum { VALUE = 1 };
enum { VALUE = N > 0 ? N : 0 };
};
// A formatting argument. It is a POD type to allow storage in