From 5cde13f21d36c7224b0e13d11c4b49379ae5210d Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 6 Oct 2016 10:38:45 +0900 Subject: Imported Upstream version 1.61.0 Change-Id: I96a1f878d1e6164f01e9aadd5147f38fca448d90 Signed-off-by: DongHun Kwak --- boost/coroutine2/detail/push_coroutine.hpp | 115 +++++++++++++++-------------- 1 file changed, 59 insertions(+), 56 deletions(-) (limited to 'boost/coroutine2/detail/push_coroutine.hpp') diff --git a/boost/coroutine2/detail/push_coroutine.hpp b/boost/coroutine2/detail/push_coroutine.hpp index 1a2d01f67e..5d9d092b65 100644 --- a/boost/coroutine2/detail/push_coroutine.hpp +++ b/boost/coroutine2/detail/push_coroutine.hpp @@ -12,9 +12,9 @@ #include #include -#include #include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -34,27 +34,28 @@ private: control_block * cb_; - explicit push_coroutine( control_block *); + explicit push_coroutine( control_block *) noexcept; public: - template< typename Fn > - explicit push_coroutine( Fn &&, bool = false); + template< typename Fn, + typename = detail::disable_overload< push_coroutine, Fn > + > + explicit push_coroutine( Fn &&); template< typename StackAllocator, typename Fn > - explicit push_coroutine( StackAllocator, Fn &&, bool = false); + push_coroutine( StackAllocator, Fn &&); - ~push_coroutine(); + ~push_coroutine() noexcept; push_coroutine( push_coroutine const&) = delete; push_coroutine & operator=( push_coroutine const&) = delete; - push_coroutine( push_coroutine &&); + push_coroutine( push_coroutine &&) noexcept; - push_coroutine & operator=( push_coroutine && other) { - if ( this != & other) { - cb_ = other.cb_; - other.cb_ = nullptr; - } + push_coroutine & operator=( push_coroutine && other) noexcept { + if ( this == & other) return * this; + cb_ = other.cb_; + other.cb_ = nullptr; return * this; } @@ -68,36 +69,36 @@ public: class iterator : public std::iterator< std::output_iterator_tag, void, void, void, void > { private: - push_coroutine< T > * c_; + push_coroutine< T > * c_{ nullptr }; public: - iterator() : - c_( nullptr) { - } + constexpr iterator() noexcept = default; - explicit iterator( push_coroutine< T > * c) : - c_( c) { + explicit iterator( push_coroutine< T > * c) noexcept : + c_{ c } { } iterator & operator=( T t) { BOOST_ASSERT( c_); - if ( ! ( * c_)( t) ) c_ = 0; + if ( ! ( * c_)( t) ) { + c_ = nullptr; + } return * this; } - bool operator==( iterator const& other) const { + bool operator==( iterator const& other) const noexcept { return other.c_ == c_; } - bool operator!=( iterator const& other) const { + bool operator!=( iterator const& other) const noexcept { return other.c_ != c_; } - iterator & operator*() { + iterator & operator*() noexcept { return * this; } - iterator & operator++() { + iterator & operator++() noexcept { return * this; } }; @@ -113,27 +114,28 @@ private: control_block * cb_; - explicit push_coroutine( control_block *); + explicit push_coroutine( control_block *) noexcept; public: - template< typename Fn > - explicit push_coroutine( Fn &&, bool = false); + template< typename Fn, + typename = detail::disable_overload< push_coroutine, Fn > + > + explicit push_coroutine( Fn &&); template< typename StackAllocator, typename Fn > - explicit push_coroutine( StackAllocator, Fn &&, bool = false); + push_coroutine( StackAllocator, Fn &&); - ~push_coroutine(); + ~push_coroutine() noexcept; push_coroutine( push_coroutine const&) = delete; push_coroutine & operator=( push_coroutine const&) = delete; - push_coroutine( push_coroutine &&); + push_coroutine( push_coroutine &&) noexcept; - push_coroutine & operator=( push_coroutine && other) { - if ( this != & other) { - cb_ = other.cb_; - other.cb_ = nullptr; - } + push_coroutine & operator=( push_coroutine && other) noexcept { + if ( this == & other) return * this; + cb_ = other.cb_; + other.cb_ = nullptr; return * this; } @@ -145,36 +147,36 @@ public: class iterator : public std::iterator< std::output_iterator_tag, void, void, void, void > { private: - push_coroutine< T & > * c_; + push_coroutine< T & > * c_{ nullptr }; public: - iterator() : - c_( nullptr) { - } + constexpr iterator() noexcept = default; - explicit iterator( push_coroutine< T & > * c) : - c_( c) { + explicit iterator( push_coroutine< T & > * c) noexcept : + c_{ c } { } iterator & operator=( T & t) { BOOST_ASSERT( c_); - if ( ! ( * c_)( t) ) c_ = 0; + if ( ! ( * c_)( t) ) { + c_ = nullptr; + } return * this; } - bool operator==( iterator const& other) const { + bool operator==( iterator const& other) const noexcept { return other.c_ == c_; } - bool operator!=( iterator const& other) const { + bool operator!=( iterator const& other) const noexcept { return other.c_ != c_; } - iterator & operator*() { + iterator & operator*() noexcept { return * this; } - iterator & operator++() { + iterator & operator++() noexcept { return * this; } }; @@ -190,27 +192,28 @@ private: control_block * cb_; - explicit push_coroutine( control_block *); + explicit push_coroutine( control_block *) noexcept; public: - template< typename Fn > - explicit push_coroutine( Fn &&, bool = false); + template< typename Fn, + typename = detail::disable_overload< push_coroutine, Fn > + > + explicit push_coroutine( Fn &&); template< typename StackAllocator, typename Fn > - explicit push_coroutine( StackAllocator, Fn &&, bool = false); + push_coroutine( StackAllocator, Fn &&); - ~push_coroutine(); + ~push_coroutine() noexcept; push_coroutine( push_coroutine const&) = delete; push_coroutine & operator=( push_coroutine const&) = delete; - push_coroutine( push_coroutine &&); + push_coroutine( push_coroutine &&) noexcept; - push_coroutine & operator=( push_coroutine && other) { - if ( this != & other) { - cb_ = other.cb_; - other.cb_ = nullptr; - } + push_coroutine & operator=( push_coroutine && other) noexcept { + if ( this == & other) return * this; + cb_ = other.cb_; + other.cb_ = nullptr; return * this; } -- cgit v1.2.3