diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7626cc7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto whitespace=trailing-space diff --git a/.gitignore b/.gitignore index 4581ef2..dcfb8d5 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ *.exe *.out *.app + +# macOS +.DS_Store diff --git a/lib/monomial_base.hpp b/lib/monomial_base.hpp index f31d78b..44dd81a 100644 --- a/lib/monomial_base.hpp +++ b/lib/monomial_base.hpp @@ -219,15 +219,15 @@ namespace gb {} monomial_static_t(const monomial_static& m) + : _size(m._size) { - _size = m.size(); - memcpy(_data, m._data, (std::size_t)(_size)*sizeof(pair_t)); + std::copy(m._data, m._data + _size, _data); } monomial_static_t(const monomial_dynamic& m) + : _size(m.data()._size) { - _size = m.size(); - memcpy(_data, m.data()._data, (std::size_t)(_size)*sizeof(pair_t)); + std::copy(m.data()._data, m.data()._data + _size, _data); } template @@ -264,15 +264,15 @@ namespace gb monomial_static_t& operator=(const monomial_static& m) { - _size = m.size(); - memcpy(_data, m._data, (std::size_t)(_size)*sizeof(pair_t)); - return *this; + _size = m._size; + std::copy(m._data, m._data + _size, _data); + return *this; } monomial_static_t& operator=(const monomial_dynamic& m) { _size = m.size(); - memcpy(_data, m.data()._data, (std::size_t)(_size)*sizeof(pair_t)); + std::copy(m.data()._data, m.data()._data + _size, _data); return *this; } diff --git a/lib/monomial_degrevlex.hpp b/lib/monomial_degrevlex.hpp index 0f42926..b00f9c0 100644 --- a/lib/monomial_degrevlex.hpp +++ b/lib/monomial_degrevlex.hpp @@ -532,12 +532,19 @@ namespace gb struct const_iterator_end {}; class const_iterator - : public std::iterator { - int _d; - unsigned _li; - int_type _v; - pair_t _ve; + public: + using iterator_category = std::forward_iterator_tag; + using value_type = pair_t; + using difference_type = std::ptrdiff_t; + using pointer = const pair_t*; + using reference = const pair_t&; + + private: + int _d; + unsigned _li; + int_type _v; + pair_t _ve; public: const_iterator() : _d(-1) diff --git a/src/m4gb.hpp b/src/m4gb.hpp index a1967ea..081896c 100644 --- a/src/m4gb.hpp +++ b/src/m4gb.hpp @@ -959,7 +959,7 @@ namespace gb barrier_t& barrier; std::atomic_size_t& index; }; - for (int i = 0; i < threadpool.size() + 1; ++i) + for (std::size_t i = 0; i < threadpool.size() + 1; ++i) threadpool.push(worker_t(*this, mat, barrier, index)); threadpool.wait_work(); for (int i = 0; i < (int)(mat.size());)