mirror of
https://github.com/boostorg/coroutine2.git
synced 2025-05-11 13:34:08 +00:00
exclude ctor with forwarding-reference from overload resolution
- prevents ctor with forwarding-reference to be used a copy-ctor
This commit is contained in:
parent
6898e58f13
commit
214b15674c
34
include/boost/coroutine2/detail/disable_overload.hpp
Normal file
34
include/boost/coroutine2/detail/disable_overload.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
// Copyright Oliver Kowalke 2014.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#ifndef BOOST_COROUTINES2_DETAIL_DISABLE_OVERLOAD_H
|
||||||
|
#define BOOST_COROUTINES2_DETAIL_DISABLE_OVERLOAD_H
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/context/detail/disable_overload.hpp>
|
||||||
|
|
||||||
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
|
# include BOOST_ABI_PREFIX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace coroutines2 {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template< typename X, typename Y >
|
||||||
|
using disable_overload = boost::context::detail::disable_overload< X, Y >;
|
||||||
|
|
||||||
|
}}}
|
||||||
|
|
||||||
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
|
#include BOOST_ABI_SUFFIX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // BOOST_COROUTINES2_DETAIL_DISABLE_OVERLOAD_H
|
@ -14,6 +14,7 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
|
#include <boost/coroutine2/detail/disable_overload.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_PREFIX
|
# include BOOST_ABI_PREFIX
|
||||||
@ -38,7 +39,9 @@ private:
|
|||||||
bool has_result_() const noexcept;
|
bool has_result_() const noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename = detail::disable_overload< pull_coroutine, Fn >
|
||||||
|
>
|
||||||
explicit pull_coroutine( Fn &&);
|
explicit pull_coroutine( Fn &&);
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
@ -148,7 +151,9 @@ private:
|
|||||||
bool has_result_() const noexcept;
|
bool has_result_() const noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename = detail::disable_overload< pull_coroutine, Fn >
|
||||||
|
>
|
||||||
explicit pull_coroutine( Fn &&);
|
explicit pull_coroutine( Fn &&);
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
@ -256,7 +261,9 @@ private:
|
|||||||
explicit pull_coroutine( control_block *) noexcept;
|
explicit pull_coroutine( control_block *) noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename = detail::disable_overload< pull_coroutine, Fn >
|
||||||
|
>
|
||||||
explicit pull_coroutine( Fn &&);
|
explicit pull_coroutine( Fn &&);
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
#include <boost/coroutine2/detail/create_control_block.ipp>
|
#include <boost/coroutine2/detail/create_control_block.ipp>
|
||||||
|
#include <boost/coroutine2/detail/disable_overload.hpp>
|
||||||
#include <boost/coroutine2/fixedsize_stack.hpp>
|
#include <boost/coroutine2/fixedsize_stack.hpp>
|
||||||
#include <boost/coroutine2/segmented_stack.hpp>
|
#include <boost/coroutine2/segmented_stack.hpp>
|
||||||
|
|
||||||
@ -40,7 +41,9 @@ pull_coroutine< T >::has_result_() const noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename
|
||||||
|
>
|
||||||
pull_coroutine< T >::pull_coroutine( Fn && fn) :
|
pull_coroutine< T >::pull_coroutine( Fn && fn) :
|
||||||
pull_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
pull_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
||||||
}
|
}
|
||||||
@ -107,7 +110,9 @@ pull_coroutine< T & >::has_result_() const noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename
|
||||||
|
>
|
||||||
pull_coroutine< T & >::pull_coroutine( Fn && fn) :
|
pull_coroutine< T & >::pull_coroutine( Fn && fn) :
|
||||||
pull_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
pull_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
||||||
}
|
}
|
||||||
@ -167,7 +172,9 @@ pull_coroutine< void >::pull_coroutine( control_block * cb) noexcept :
|
|||||||
cb_{ cb } {
|
cb_{ cb } {
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename
|
||||||
|
>
|
||||||
pull_coroutine< void >::pull_coroutine( Fn && fn) :
|
pull_coroutine< void >::pull_coroutine( Fn && fn) :
|
||||||
pull_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
pull_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
|
#include <boost/coroutine2/detail/disable_overload.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_PREFIX
|
# include BOOST_ABI_PREFIX
|
||||||
@ -36,7 +37,9 @@ private:
|
|||||||
explicit push_coroutine( control_block *) noexcept;
|
explicit push_coroutine( control_block *) noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename = detail::disable_overload< push_coroutine, Fn >
|
||||||
|
>
|
||||||
explicit push_coroutine( Fn &&);
|
explicit push_coroutine( Fn &&);
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
@ -114,7 +117,9 @@ private:
|
|||||||
explicit push_coroutine( control_block *) noexcept;
|
explicit push_coroutine( control_block *) noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename = detail::disable_overload< push_coroutine, Fn >
|
||||||
|
>
|
||||||
explicit push_coroutine( Fn &&);
|
explicit push_coroutine( Fn &&);
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
@ -190,7 +195,9 @@ private:
|
|||||||
explicit push_coroutine( control_block *) noexcept;
|
explicit push_coroutine( control_block *) noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename = detail::disable_overload< push_coroutine, Fn >
|
||||||
|
>
|
||||||
explicit push_coroutine( Fn &&);
|
explicit push_coroutine( Fn &&);
|
||||||
|
|
||||||
template< typename StackAllocator, typename Fn >
|
template< typename StackAllocator, typename Fn >
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <boost/coroutine2/detail/config.hpp>
|
#include <boost/coroutine2/detail/config.hpp>
|
||||||
#include <boost/coroutine2/detail/create_control_block.ipp>
|
#include <boost/coroutine2/detail/create_control_block.ipp>
|
||||||
|
#include <boost/coroutine2/detail/disable_overload.hpp>
|
||||||
#include <boost/coroutine2/fixedsize_stack.hpp>
|
#include <boost/coroutine2/fixedsize_stack.hpp>
|
||||||
#include <boost/coroutine2/segmented_stack.hpp>
|
#include <boost/coroutine2/segmented_stack.hpp>
|
||||||
|
|
||||||
@ -33,7 +34,9 @@ push_coroutine< T >::push_coroutine( control_block * cb) noexcept :
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename
|
||||||
|
>
|
||||||
push_coroutine< T >::push_coroutine( Fn && fn) :
|
push_coroutine< T >::push_coroutine( Fn && fn) :
|
||||||
push_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
push_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
||||||
}
|
}
|
||||||
@ -91,7 +94,9 @@ push_coroutine< T & >::push_coroutine( control_block * cb) noexcept :
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename
|
||||||
|
>
|
||||||
push_coroutine< T & >::push_coroutine( Fn && fn) :
|
push_coroutine< T & >::push_coroutine( Fn && fn) :
|
||||||
push_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
push_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
||||||
}
|
}
|
||||||
@ -141,7 +146,9 @@ push_coroutine< void >::push_coroutine( control_block * cb) noexcept :
|
|||||||
cb_{ cb } {
|
cb_{ cb } {
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename Fn >
|
template< typename Fn,
|
||||||
|
typename
|
||||||
|
>
|
||||||
push_coroutine< void >::push_coroutine( Fn && fn) :
|
push_coroutine< void >::push_coroutine( Fn && fn) :
|
||||||
push_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
push_coroutine{ default_stack(), std::forward< Fn >( fn) } {
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user