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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#include <bits/stdc++.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include "template/debug.hpp"

using namespace std;


template<class T = int> struct matrix : vector<vector<T>> {
    matrix(size_t h, size_t w, T init = T()) : vector<vector<T>> (h, vector<T> (w, init)) {}
    inline T& operator()(size_t i, size_t j) { return (*this)[i][j]; }
};

template<class T = int, class C = vector<T>> struct prime_sieve : C {
    prime_sieve(size_t max) : is_prime(max+1, true) {
        is_prime[0] = is_prime[1] = false;
        for(size_t p=2; p<=max; p++) if(is_prime[p]) {
            for(size_t i=p*p; i<=max; i+=p) is_prime[i] = false;
            this->emplace_back(p);
        }
    }
    bool operator()(size_t index) {
        return is_prime[index];
    }
  private:
    vector<bool> is_prime;
};

template<class T> struct Iterator {
  const T* p;
  const T& operator*() { return *p; }
  Iterator& operator++() { ++p; return *this; }
  bool operator!=(const Iterator& v) { return p != v.p; }
  ptrdiff_t operator-(const Iterator& v) { return p - v.p; }
};
template<class T> ptrdiff_t distance(Iterator<T>& a, Iterator<T>& b) { return b - a; };

struct MyString {
    const char* s;
    Iterator<char> begin() { return { s }; }
    Iterator<char> end() { return { s + strlen(s) }; }
};

struct MyStructure0 {
    MyStructure0(int a, int b, int c, int d) : a(a), b(b), c(c), d(d) {}
    vector<int> _debug() const {
        return { 0, a + b + c + d, a * b * c * d };
    }
  private:
    int a, b, c, d;
};

struct MyStructure1 {
    MyStructure1(int a, int b, int c, int d) : a(a), b(b), c(c), d(d) {}
    friend vector<int> _debug(const MyStructure1 &s);
  private:
    int a, b, c, d;
};

vector<int> _debug(const MyStructure1 &s) {
    return { 1, s.a + s.b + s.c + s.d, s.a * s.b * s.c * s.d };
}

// template<unsigned long N> debugger::debug_t _debug(bitset<N> &bist) {
//     return bist.to_string();
// }

string _debug(bitset<10UL> bist)  {<--- Function parameter 'bist' should be passed by const reference.
    return bist.to_string();
}

signed main() {

    debug('a', "abcdefg", string("abcdefg"));

    debug(1, 1U, 1L, 1UL, 1LL, 1ULL, 1.0, 1.0L);

    vector<int> vec_1d = { 1, 2, 3, 4 };<--- Variable 'vec_1d' is assigned a value that is never used.
    debug(vec_1d);

    vector<vector<int>> vec_2d = { { 1, 2, 3, 4 }, { 1, 3, 5 }, { 1, 4, 10 } };<--- Variable 'vec_2d' is assigned a value that is never used.
    debug(vec_2d);

    matrix<int> matrix1(10, 5, 0);<--- Variable 'matrix1' is assigned a value that is never used.
    debug(matrix1);

    matrix matrix2(2, 3, 0.0L);
    debug(matrix2);

    vector vector_string = { "string", "abcdefg" };
    debug(vector_string);

    set<int> set_int = { 0, 3, 6, 1, 2, 3, 0 };<--- Variable 'set_int' is assigned a value that is never used.
    debug(set_int);

    unordered_set<int> unord_set_int = { 0, 3, 6, 1, 2, 3, 0 };<--- Variable 'unord_set_int' is assigned a value that is never used.
    debug(unord_set_int);

    map<int,int> map__int_int = { { 0, 3 }, { 6, 1 }, { 2, 3 } };<--- Variable 'map__int_int' is assigned a value that is never used.
    debug(map__int_int);

    // unordered_map<int,int> unord_map__int_int = { { 0, 3 }, { 6, 1 }, { 2, 3 } };
    // debug(unord_map__int_int);

    debug(prime_sieve(100));

    // debug(MyString{"abcdefg"});
    debug(string{string{"abcdefg"}});

    static_assert(!uni::internal::is_loggable_v<int>);
    static_assert(!uni::internal::is_loggable_v<vector<int>>);
    static_assert(uni::internal::is_loggable_v<MyStructure0>);
    static_assert(uni::internal::is_loggable_v<MyStructure1>);

    MyStructure0 my_structure0 = { 1, 2, 3, 4 };<--- Variable 'my_structure0' is assigned a value that is never used.
    debug(my_structure0);

    MyStructure1 my_structure1 = { 1, 2, 3, 4 };<--- Variable 'my_structure1' is assigned a value that is never used.
    debug(my_structure1);

    pair<int,MyStructure0> pair__my_structure0 = { 0, { 1, 2, 3, 4 } };<--- Variable 'pair__my_structure0' is assigned a value that is never used.
    debug(pair__my_structure0);

    pair<int,MyStructure1> pair__my_structure1 = { 0, { 1, 2, 3, 4 } };<--- Variable 'pair__my_structure1' is assigned a value that is never used.
    debug(pair__my_structure1);

    vector<pair<int,MyStructure0>> vector_pair__my_structure0 = { { 0, { 1, 2, 3, 4 } }, { 1, { 1, 2, 3, 4 } } };<--- Variable 'vector_pair__my_structure0' is assigned a value that is never used.
    debug(vector_pair__my_structure0);

    vector<pair<int,MyStructure1>> vector_pair__my_structure1 = { { 0, { 1, 2, 3, 4 } }, { 1, { 1, 2, 3, 4 } } };<--- Variable 'vector_pair__my_structure1' is assigned a value that is never used.
    debug(vector_pair__my_structure1);

    map<vector<string>,set<pair<int,tuple<string,char,unsigned>>>> complexed = {<--- Variable 'complexed' is assigned a value that is never used.
        { { "str0", "str1" }, { { 1, { "str2", 'c', 1124 } } } }
    };
    // static_assert(!uni::internal::wrapping_type_of<map<vector<string>,, std::basic_string>);
    debug(complexed);

    debug(
        map<vector<string>,set<pair<int,tuple<string,char,unsigned>>>> {
            { { "str0", "str1" }, { { 1, { "str2", 'c', 1124 } } } }
        }
    );

    std::queue<int> que;
    que.push(3), que.push(1), que.push(4), que.push(1);
    debug(que);

    std::stack<int> stk;
    stk.push(3), stk.push(1), stk.push(4), stk.push(1);
    debug(stk);

    std::priority_queue<int> prique;
    prique.push(3), prique.push(1), prique.push(4), prique.push(1);
    debug(prique);

    return 0;
}