diff --git a/include/DataFrame/MMap/ObjectVector.h b/include/DataFrame/MMap/ObjectVector.h index 1da97b6a5..2f6e2da81 100644 --- a/include/DataFrame/MMap/ObjectVector.h +++ b/include/DataFrame/MMap/ObjectVector.h @@ -61,7 +61,7 @@ class ObjectVector : protected B { using size_type = typename BaseClass::size_type; using value_type = T; using difference_type = std::ptrdiff_t; - using ponter = value_type *; + using pointer = value_type *; using const_pointer = const value_type *; using const_pointer_const = const value_type *const; using reference = value_type &; @@ -181,7 +181,7 @@ class ObjectVector : protected B { mutable size_type cached_object_count_ { 0 }; - inline void setup_(); + inline void setup_ (); inline size_type tell_ () const noexcept; inline void unlink_ () { BaseClass::unlink (); } inline int write_ (const value_type *data_ele, size_type count); @@ -708,11 +708,13 @@ class ObjectVector : protected B { inline reverse_iterator rend() noexcept { return (reverse_iterator (&((*this)[0]) - 1)); } - inline const_reverse_iterator rbegin () const noexcept { + inline const_reverse_iterator + rbegin () const noexcept { return (const_reverse_iterator (&((*this)[size() - 1]))); } - inline const_reverse_iterator rend () const noexcept { + inline const_reverse_iterator + rend () const noexcept { return (const_reverse_iterator (&((*this)[0]) - 1)); } diff --git a/include/DataFrame/MMap/ObjectVector.tcc b/include/DataFrame/MMap/ObjectVector.tcc index b87c8bd48..cfbe88465 100644 --- a/include/DataFrame/MMap/ObjectVector.tcc +++ b/include/DataFrame/MMap/ObjectVector.tcc @@ -348,10 +348,10 @@ template template void ObjectVector::insert (iterator pos, I first, I last) { - const long int to_add = &(*last) - &(*first); + const size_type to_add = &(*last) - &(*first); const size_type pos_index = &(*pos) - &(*begin ()); - BaseClass::truncate (BaseClass::_file_size + to_add * sizeof (value_type)); + BaseClass::truncate(BaseClass::_file_size + to_add * sizeof (value_type)); const iterator new_pos = begin() + pos_index; diff --git a/include/DataFrame/Vectors/VectorPtrView.h b/include/DataFrame/Vectors/VectorPtrView.h index 26db23454..4933ae58e 100644 --- a/include/DataFrame/Vectors/VectorPtrView.h +++ b/include/DataFrame/Vectors/VectorPtrView.h @@ -581,26 +581,21 @@ class VectorPtrView { public: - inline iterator begin () noexcept { - - return (iterator (&(*(vector_.begin())))); - } + inline iterator + begin () noexcept { return (iterator (&(*(vector_.begin())))); } inline iterator end () noexcept { return (iterator(&(*(vector_.end())))); } - inline const_iterator begin () const noexcept { - - return (const_iterator (&(*(vector_.begin())))); - } - inline const_iterator end () const noexcept { - - return (const_iterator(&(*(vector_.end())))); - } - - inline const_reverse_iterator rbegin () const noexcept { + inline const_iterator + begin() const noexcept { return (const_iterator (&(*(vector_.begin())))); } + inline const_iterator + end () const noexcept { return (const_iterator(&(*(vector_.end())))); } + inline const_reverse_iterator + rbegin () const noexcept { return (const_reverse_iterator (&(*(vector_.rbegin())))); } - inline const_reverse_iterator rend () const noexcept { + inline const_reverse_iterator + rend () const noexcept { return (const_reverse_iterator (&(*(vector_.rend())))); } diff --git a/include/DataFrame/Vectors/VectorView.h b/include/DataFrame/Vectors/VectorView.h index 89cb22739..481fc565e 100644 --- a/include/DataFrame/Vectors/VectorView.h +++ b/include/DataFrame/Vectors/VectorView.h @@ -34,7 +34,13 @@ class VectorView { public: - inline VectorView() = default; + VectorView() = default; + VectorView(const VectorView &) = default; + VectorView(VectorView &&) = default; + VectorView &operator= (const VectorView &) = default; + VectorView &operator= (VectorView &&) = default; + ~VectorView() = default; + inline VectorView (value_type *bp, value_type *ep) noexcept : begin_ptr_(bp), end_ptr_(ep) { } @@ -45,6 +51,9 @@ class VectorView { } inline void clear () noexcept { begin_ptr_ = end_ptr_ = nullptr; } + inline reference at (size_type i) noexcept { return (*(begin_ptr_ + i)); } + inline const_reference + at (size_type i) const noexcept { return (*(begin_ptr_ + i)); } inline reference operator [] (size_type i) noexcept { return (*(begin_ptr_ + i)); @@ -58,9 +67,10 @@ class VectorView { inline reference back() noexcept { return (*(end_ptr_ - 1)); } inline const_reference back() const noexcept { return (*(end_ptr_ - 1)); } - // This is to match the std::vector interface, so things will compile + // These are to match the std::vector interface, so things will compile // inline void shrink_to_fit() { } + inline void reserve (size_type) { } inline void swap (VectorView &rhs) noexcept { @@ -219,7 +229,7 @@ class VectorView { private: - const_pointer node_ {nullptr}; + const_pointer node_ { nullptr }; }; class iterator; @@ -351,7 +361,7 @@ class VectorView { private: - const_pointer node_ {nullptr}; + const_pointer node_ { nullptr }; friend class VectorView::const_reverse_iterator; }; @@ -466,7 +476,7 @@ class VectorView { private: - pointer node_ {nullptr}; + pointer node_ { nullptr }; friend class VectorView::const_iterator; }; @@ -481,14 +491,9 @@ class VectorView { end () const noexcept { return (const_iterator (end_ptr_)); } inline const_reverse_iterator - rbegin () const noexcept { - - return (const_reverse_iterator (end_ptr_ - 1)); - } - inline const_reverse_iterator rend () const noexcept { - - return (const_reverse_iterator (begin_ptr_ - 1)); - } + rbegin() const noexcept { return (const_reverse_iterator(end_ptr_ - 1)); } + inline const_reverse_iterator + rend() const noexcept { return (const_reverse_iterator(begin_ptr_ - 1)); } }; } // namespace hmdf