Skip to content

Commit

Permalink
3
Browse files Browse the repository at this point in the history
  • Loading branch information
fintarin committed Apr 8, 2024
1 parent 21c4157 commit d60bb43
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 32 deletions.
6 changes: 3 additions & 3 deletions include/fintamath/functions/IFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class IFunction : public IMathObject {

virtual MathObjectClass getReturnClass() const noexcept = 0;

virtual bool doArgsMatch(const ArgumentRefVector &argVect) const = 0;
virtual bool doArgsMatch(const ArgumentRefVector &argVect) const noexcept = 0;

virtual bool isVariadic() const = 0;
virtual bool isVariadic() const noexcept = 0;

virtual bool isEvaluatable() const = 0;
virtual bool isEvaluatable() const noexcept = 0;

std::unique_ptr<IMathObject> operator()(const std::derived_from<IMathObject> auto &...args) const {
const ArgumentRefVector argVect = {args...};
Expand Down
22 changes: 11 additions & 11 deletions include/fintamath/functions/IFunctionCRTP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class IFunctionCRTP_ : public IFunction {
}

const std::vector<MathObjectClass> &getArgumentClasses() const noexcept final {
static const auto &argClasses = getArgumentClassesStatic();
static const std::vector<MathObjectClass> argClassesVect(argClasses.begin(), argClasses.end());
static const std::vector<MathObjectClass> argClassesVect(getArgumentClassesStatic().begin(),
getArgumentClassesStatic().end());
return argClassesVect;
}

Expand All @@ -33,7 +33,7 @@ class IFunctionCRTP_ : public IFunction {
return getReturnClassStatic();
}

bool doArgsMatch(const ArgumentRefVector &argVect) const override {
bool doArgsMatch(const ArgumentRefVector &argVect) const noexcept override {
if constexpr (Derived::isVariadicStatic()) {
return doVariadicArgsMatch(argVect);
}
Expand All @@ -46,19 +46,19 @@ class IFunctionCRTP_ : public IFunction {
}
}

bool isVariadic() const final {
bool isVariadic() const noexcept final {
return Derived::isVariadicStatic();
}

static constexpr bool isVariadicStatic() {
static constexpr bool isVariadicStatic() noexcept {
return false;
}

bool isEvaluatable() const final {
bool isEvaluatable() const noexcept final {
return Derived::isEvaluatableStatic();
}

static constexpr bool isEvaluatableStatic() {
static constexpr bool isEvaluatableStatic() noexcept {
return true;
}

Expand All @@ -84,7 +84,7 @@ class IFunctionCRTP_ : public IFunction {

private:
template <size_t i, typename Head, typename... Tail>
static bool doArgsMatch(const ArgumentRefVector &argVect) {
static bool doArgsMatch(const ArgumentRefVector &argVect) noexcept {
if (!doArgMatch<Head>(argVect[i])) {
return false;
}
Expand All @@ -93,11 +93,11 @@ class IFunctionCRTP_ : public IFunction {
}

template <size_t>
static bool doArgsMatch(const ArgumentRefVector &) {
static bool doArgsMatch(const ArgumentRefVector & /*argVect*/) noexcept {
return true;
}

static bool doVariadicArgsMatch(const ArgumentRefVector &argVect) {
static bool doVariadicArgsMatch(const ArgumentRefVector &argVect) noexcept {
if (argVect.empty()) {
return false;
}
Expand All @@ -110,7 +110,7 @@ class IFunctionCRTP_ : public IFunction {
}

template <typename Expected>
static bool doArgMatch(const ArgumentRef &arg) {
static bool doArgMatch(const ArgumentRef &arg) noexcept {
return is<Expected>(arg);
}

Expand Down
4 changes: 2 additions & 2 deletions include/fintamath/functions/IOperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class IOperator : public IFunction {
};

public:
virtual Priority getPriority() const = 0;
virtual Priority getPriority() const noexcept = 0;

virtual bool isAssociative() const = 0;
virtual bool isAssociative() const noexcept = 0;
};

template <typename Return, typename Derived, typename... Args>
Expand Down
6 changes: 3 additions & 3 deletions include/fintamath/functions/IOperatorCRTP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ class IOperatorCRTP_ : public IOperator {
#undef I_FUNCTION_CRTP

public:
IOperator::Priority getPriority() const final {
IOperator::Priority getPriority() const noexcept final {
return Derived::getPriorityStatic();
}

static constexpr bool isAssociativeStatic() {
static constexpr bool isAssociativeStatic() noexcept {
return false;
}

bool isAssociative() const final {
bool isAssociative() const noexcept final {
return Derived::isAssociativeStatic();
}

Expand Down
11 changes: 5 additions & 6 deletions include/fintamath/literals/Boolean.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ class Boolean : public ILiteralCRTP<Boolean> {
FINTAMATH_CLASS_BODY(Boolean, ILiteral)

public:
Boolean();

explicit Boolean(const std::string &str);
Boolean() noexcept;

template <std::same_as<bool> Bool>
Boolean(const Bool val) : name(val ? trueStr : falseStr) {
}
Boolean(const Bool val) noexcept : name(val ? trueStr : falseStr) {}

explicit Boolean(const std::string &str);

std::string toString() const noexcept override;

explicit operator bool() const;
explicit operator bool() const noexcept;

private:
std::string name;
Expand Down
2 changes: 1 addition & 1 deletion include/fintamath/numbers/Complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Complex : public INumberCRTP<Complex> {
FINTAMATH_CLASS_BODY(Complex, INumber)

public:
Complex() = default;
Complex() noexcept = default;

Complex(const Complex &rhs);

Expand Down
2 changes: 1 addition & 1 deletion include/fintamath/numbers/Integer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Integer : public INumberCRTP<Integer> {
using Backend = boost::multiprecision::mpz_int;

public:
Integer() = default;
Integer() noexcept = default;

Integer(std::integral auto rhs) noexcept : backend(rhs) {}

Expand Down
2 changes: 1 addition & 1 deletion include/fintamath/numbers/Rational.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Rational : public INumberCRTP<Rational> {
FINTAMATH_CLASS_BODY(Rational, INumber)

public:
Rational() = default;
Rational() noexcept = default;

Rational(std::integral auto rhs) : numer(rhs) {}

Expand Down
2 changes: 1 addition & 1 deletion include/fintamath/numbers/Real.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Real : public INumberCRTP<Real> {
};

public:
Real() = default;
Real() noexcept = default;

Real(Backend inBackend);

Expand Down
4 changes: 2 additions & 2 deletions src/fintamath/literals/Boolean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace fintamath {

FINTAMATH_CLASS_IMPLEMENTATION(Boolean)

Boolean::Boolean() : name(falseStr) {
Boolean::Boolean() noexcept : name(falseStr) {
}

Boolean::Boolean(const std::string &str) {
Expand All @@ -21,7 +21,7 @@ std::string Boolean::toString() const noexcept {
return name;
}

Boolean::operator bool() const {
Boolean::operator bool() const noexcept {
return name == trueStr;
}

Expand Down
2 changes: 1 addition & 1 deletion src/fintamath/numbers/Integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int Integer::sign() const noexcept {
return backend.sign();
}

const Integer::Backend &Integer::getBackend() const noexcept{
const Integer::Backend &Integer::getBackend() const noexcept {
return backend;
}

Expand Down

0 comments on commit d60bb43

Please sign in to comment.