mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-02-17 11:45:50 +00:00
Add assignment operators.
This commit is contained in:
parent
64b5affa4f
commit
7da13f6677
2 changed files with 45 additions and 0 deletions
|
@ -66,6 +66,13 @@ namespace mchlib {
|
|||
DirIterator ( VecIterator parBegin, VecIterator parEnd, const PathName* parBasePath, std::size_t parLevelOffset );
|
||||
~DirIterator ( void ) noexcept;
|
||||
|
||||
DirIterator& operator= ( DirIterator&& parOther );
|
||||
DirIterator& operator= ( const DirIterator& parOther );
|
||||
template <bool OtherConst>
|
||||
DirIterator& operator= ( typename std::enable_if<std::is_convertible<typename DirIterator<OtherConst>::VecIterator, VecIterator>::value, DirIterator<OtherConst>>::type&& parOther );
|
||||
template <bool OtherConst>
|
||||
DirIterator& operator= ( const typename std::enable_if<std::is_convertible<typename DirIterator<OtherConst>::VecIterator, VecIterator>::value, DirIterator<OtherConst>>::type& parOther );
|
||||
|
||||
private:
|
||||
void increment ( void );
|
||||
difference_type distance_to ( const DirIterator<Const>& parOther ) const;
|
||||
|
|
|
@ -99,6 +99,44 @@ namespace mchlib {
|
|||
DirIterator<Const>::~DirIterator() noexcept {
|
||||
}
|
||||
|
||||
template <bool Const>
|
||||
DirIterator<Const>& DirIterator<Const>::operator= (DirIterator&& parOther) {
|
||||
m_current = std::move(parOther.m_current);
|
||||
m_end = std::move(parOther.m_end);
|
||||
m_base_path = std::move(parOther.m_base_path);
|
||||
m_level_offset = parOther.m_level_offset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <bool Const>
|
||||
DirIterator<Const>& DirIterator<Const>::operator= (const DirIterator& parOther) {
|
||||
m_current = parOther.m_current;
|
||||
m_end = parOther.m_end;
|
||||
m_base_path = parOther.m_base_path;
|
||||
m_level_offset = parOther.m_level_offset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <bool Const>
|
||||
template <bool OtherConst>
|
||||
DirIterator<Const>& DirIterator<Const>::operator= (typename std::enable_if<std::is_convertible<typename DirIterator<OtherConst>::VecIterator, VecIterator>::value, DirIterator<OtherConst>>::type&& parOther) {
|
||||
m_current = parOther.m_current;
|
||||
m_end = parOther.m_end;
|
||||
m_base_path = std::move(parOther.m_base_path);
|
||||
m_level_offset = parOther.m_level_offset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <bool Const>
|
||||
template <bool OtherConst>
|
||||
DirIterator<Const>& DirIterator<Const>::operator= (const typename std::enable_if<std::is_convertible<typename DirIterator<OtherConst>::VecIterator, VecIterator>::value, DirIterator<OtherConst>>::type& parOther) {
|
||||
m_current = parOther.m_current;
|
||||
m_end = parOther.m_end;
|
||||
m_base_path = parOther.m_base_path;
|
||||
m_level_offset = parOther.m_level_offset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <bool Const>
|
||||
void DirIterator<Const>::increment() {
|
||||
assert(PathName(m_current->abs_path).pop_right() == *m_base_path);
|
||||
|
|
Loading…
Add table
Reference in a new issue