mirror of
https://github.com/boostorg/coroutine2.git
synced 2025-05-11 05:24:01 +00:00
Fix ambiguity of std::begin/end
- this patch should restore the range-based for functionality for pull-type coroutines - it also keeps the behaviour when using std::begin / std::end if some standard container's header is included - it also eliminates the possible undefined behaviour / ill-formedness caused by the custom overload of std::begin / std::end
This commit is contained in:
parent
90d3194928
commit
37f08bb818
@ -130,6 +130,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
friend class iterator;
|
friend class iterator;
|
||||||
|
|
||||||
|
iterator begin() { return iterator (this); }
|
||||||
|
iterator end() { return iterator(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
@ -238,6 +241,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
friend class iterator;
|
friend class iterator;
|
||||||
|
|
||||||
|
iterator begin() { return iterator (this); }
|
||||||
|
iterator end() { return iterator(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@ -278,6 +284,8 @@ public:
|
|||||||
explicit operator bool() const noexcept;
|
explicit operator bool() const noexcept;
|
||||||
|
|
||||||
bool operator!() const noexcept;
|
bool operator!() const noexcept;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
@ -294,22 +302,6 @@ end( pull_coroutine< T > &) {
|
|||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
namespace std {
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
typename boost::coroutines2::detail::pull_coroutine< T >::iterator
|
|
||||||
begin( boost::coroutines2::detail::pull_coroutine< T > & c) {
|
|
||||||
return boost::coroutines2::detail::begin( c);
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
typename boost::coroutines2::detail::pull_coroutine< T >::iterator
|
|
||||||
end( boost::coroutines2::detail::pull_coroutine< T > & c) {
|
|
||||||
return boost::coroutines2::detail::end( c);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_SUFFIX
|
# include BOOST_ABI_SUFFIX
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user