diff options
author | Christian Persch <chpe@src.gnome.org> | 2020-05-27 21:17:04 +0200 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2020-05-27 21:17:04 +0200 |
commit | 18912ef4fee8179c9fd2340e8e072f88bc6eda94 (patch) | |
tree | abd8cd6e2ca74e1fed0d23b457788644a4135a62 /src/libc-glue.hh | |
parent | e07d8071357fa9efa1e458930376b4df3ad17d79 (diff) | |
download | vte-18912ef4fee8179c9fd2340e8e072f88bc6eda94.tar.gz |
libc: glue: Implement swap for FD
Diffstat (limited to 'src/libc-glue.hh')
-rw-r--r-- | src/libc-glue.hh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libc-glue.hh b/src/libc-glue.hh index 1f4c46da..3e445513 100644 --- a/src/libc-glue.hh +++ b/src/libc-glue.hh @@ -92,6 +92,12 @@ public: } } + /* C++20 constexpr */ void swap(FD& other) + { + using std::swap; + swap(m_fd, other.m_fd); + } + private: int m_fd{-1}; @@ -101,6 +107,7 @@ constexpr bool operator==(FD const& lhs, FD const& rhs) noexcept { return lhs.ge constexpr bool operator==(FD const& lhs, int rhs) noexcept { return lhs.get() == rhs; } constexpr bool operator!=(FD const& lhs, FD const& rhs) noexcept { return !(lhs == rhs); } constexpr bool operator!=(FD const& lhs, int rhs) noexcept { return !(lhs == rhs); } +/* C++20 constexpr */ inline void swap(FD& lhs, FD& rhs) noexcept { lhs.swap(rhs); } /* FD convenience functions */ |