feat: enable to swap comment and strings

This commit is contained in:
ToruNiina 2019-07-13 14:33:14 +09:00
parent 24a05c7c93
commit 87e0ba201e

View File

@ -162,12 +162,15 @@ struct preserve_comments
const_reverse_iterator crbegin() const noexcept {return comments.crbegin();}
const_reverse_iterator crend() const noexcept {return comments.crend();}
friend bool operator==(const preserve_comments& lhs, const preserve_comments& rhs);
friend bool operator!=(const preserve_comments& lhs, const preserve_comments& rhs);
friend bool operator< (const preserve_comments& lhs, const preserve_comments& rhs);
friend bool operator<=(const preserve_comments& lhs, const preserve_comments& rhs);
friend bool operator> (const preserve_comments& lhs, const preserve_comments& rhs);
friend bool operator>=(const preserve_comments& lhs, const preserve_comments& rhs);
friend bool operator==(const preserve_comments&, const preserve_comments&);
friend bool operator!=(const preserve_comments&, const preserve_comments&);
friend bool operator< (const preserve_comments&, const preserve_comments&);
friend bool operator<=(const preserve_comments&, const preserve_comments&);
friend bool operator> (const preserve_comments&, const preserve_comments&);
friend bool operator>=(const preserve_comments&, const preserve_comments&);
friend void swap(preserve_comments&, std::vector<std::string>&);
friend void swap(std::vector<std::string>&, preserve_comments&);
private:
@ -186,6 +189,16 @@ inline void swap(preserve_comments& lhs, preserve_comments& rhs)
lhs.swap(rhs);
return;
}
inline void swap(preserve_comments& lhs, std::vector<std::string>& rhs)
{
lhs.comments.swap(rhs);
return;
}
inline void swap(std::vector<std::string>& lhs, preserve_comments& rhs)
{
lhs.swap(rhs.comments);
return;
}
template<typename charT, typename traits>
std::basic_ostream<charT, traits>&