mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-08 11:33:46 +00:00
Simplify NonZero
This commit is contained in:
parent
2ba3988da3
commit
885d1a1c64
11
format.h
11
format.h
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user