diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:38:45 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:39:52 +0900 |
commit | 5cde13f21d36c7224b0e13d11c4b49379ae5210d (patch) | |
tree | e8269ac85a4b0f7d416e2565fa4f451b5cb41351 /boost/coroutine2/detail/push_coroutine.hpp | |
parent | d9ec475d945d3035377a0d89ed42e382d8988891 (diff) | |
download | boost-5cde13f21d36c7224b0e13d11c4b49379ae5210d.tar.gz boost-5cde13f21d36c7224b0e13d11c4b49379ae5210d.tar.bz2 boost-5cde13f21d36c7224b0e13d11c4b49379ae5210d.zip |
Imported Upstream version 1.61.0
Change-Id: I96a1f878d1e6164f01e9aadd5147f38fca448d90
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/coroutine2/detail/push_coroutine.hpp')
-rw-r--r-- | boost/coroutine2/detail/push_coroutine.hpp | 115 |
1 files changed, 59 insertions, 56 deletions
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 <boost/assert.hpp> #include <boost/config.hpp> -#include <boost/context/execution_context.hpp> #include <boost/coroutine2/detail/config.hpp> +#include <boost/coroutine2/detail/disable_overload.hpp> #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; } |