1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once


#include <utility>
#include <concepts><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.


#include "internal/dev_env.hpp"
#include "numeric/arithmetic.hpp"


namespace uni {

namespace algebraic {


template<class Derived>
struct scalar_multipliable {
    struct identity {
        template<std::integral Scalar>
        friend inline Derived operator*(const Scalar, const Derived& val) noexcept(NO_EXCEPT) {
            return val;
        }
    };


    struct automatic {
        template<std::integral Scalar>
        friend inline Derived operator*(const Scalar k, const Derived& val) noexcept(NO_EXCEPT) {
            return uni::pow<Derived, Scalar, std::plus<Derived>>(val, k, {}, {});
        }
    };
};



template<class T>
struct base {
    using value_type = T;

  protected:
    value_type _value;

  public:
    template<class... Args>
        requires std::constructible_from<value_type, Args...>
    base(Args&&... args) noexcept(NO_EXCEPT) : _value(std::forward<Args>(args)...) {}

    inline explicit operator value_type() const noexcept(NO_EXCEPT) { return this->_value; }
    inline auto val() const noexcept(NO_EXCEPT) { return this->_value; };

    inline const value_type* operator->() const noexcept(NO_EXCEPT) { return &this->_value; };
    inline value_type* operator->() noexcept(NO_EXCEPT) { return &this->_value; };


    friend inline auto operator<=>(const base& lhs, const base& rhs) noexcept(NO_EXCEPT) {
        return lhs._value <=> rhs._value;
    };

    friend inline bool operator==(const base& lhs, const base& rhs) noexcept(NO_EXCEPT) {
        return lhs._value == rhs._value;
    }
};

struct associative {};

struct commutative {};


} // namespace algebraic

} // namespace uni