1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-25 00:53:43 +00:00

Add swap() method.

This commit is contained in:
King_DuckZ 2017-08-15 10:20:12 +01:00
parent 59eff8ff56
commit 6c2431a3d0
4 changed files with 15 additions and 0 deletions

View file

@ -251,4 +251,11 @@ namespace mchlib {
std::size_t PathName::str_path_size() const { std::size_t PathName::str_path_size() const {
return calc_join_size(m_pool, is_absolute()); return calc_join_size(m_pool, is_absolute());
} }
void PathName::swap (PathName& parOther) noexcept {
if (this != &parOther) {
this->m_pool.swap(parOther.m_pool);
std::swap(m_absolute, parOther.m_absolute);
}
}
} //namespace mchlib } //namespace mchlib

View file

@ -48,6 +48,7 @@ namespace mchlib {
PathName& pop_right ( void ); PathName& pop_right ( void );
bool operator!= ( const PathName& parOther ) const; bool operator!= ( const PathName& parOther ) const;
bool operator== ( const PathName& parOther ) const; bool operator== ( const PathName& parOther ) const;
void swap (PathName& parOther) noexcept;
private: private:
static const std::string m_empty_str; static const std::string m_empty_str;

View file

@ -58,6 +58,7 @@ namespace mchlib {
const string_type* get_stringref_source ( std::size_t parIndex ) const; const string_type* get_stringref_source ( std::size_t parIndex ) const;
const stringref_type& operator[] ( std::size_t parIndex ) const; const stringref_type& operator[] ( std::size_t parIndex ) const;
void pop ( void ); void pop ( void );
void swap (StringPool& parOther) noexcept;
private: private:
PoolType m_pool; PoolType m_pool;

View file

@ -137,4 +137,10 @@ namespace mchlib {
} }
return; return;
} }
template <typename C, typename Str, typename StrRef>
void StringPool<C, Str, StrRef>::swap (StringPool& parOther) noexcept {
m_pool.swap(parOther.m_pool);
m_strings.swap(parOther.m_strings);
}
} //namespace mchlib } //namespace mchlib