use assert. static can't work

This commit is contained in:
Oliver Schönrock
2020-02-23 15:36:07 +00:00
committed by Mateusz Pusz
parent 065323c7d7
commit d4492524d1

View File

@@ -24,13 +24,13 @@
#include <units/concepts.h> #include <units/concepts.h>
#include <units/bits/dimension_op.h> #include <units/bits/dimension_op.h>
#include <cassert>
namespace units { namespace units {
constexpr std::intmax_t ipow10(std::intmax_t exp) constexpr std::intmax_t ipow10(std::intmax_t exp)
{ {
// how to assert here? assert(exp >= 0);
// static_assert(exp >= 0, "Use fpow10() for negative exponents");
if (exp == 0) return 1; if (exp == 0) return 1;
std::intmax_t result = 1; std::intmax_t result = 1;
while (exp > 0) { while (exp > 0) {