mirror of
https://github.com/boostorg/system.git
synced 2025-07-30 04:27:14 +02:00
Do not consider types with explicit operator bool (such as result itself) constructible from bool for the purposes of result construction. Refs #104.
This commit is contained in:
@ -85,6 +85,10 @@ template<class T> using remove_cvref = typename std::remove_cv< typename std::re
|
|||||||
|
|
||||||
template<class... T> using is_errc_t = std::is_same<mp11::mp_list<remove_cvref<T>...>, mp11::mp_list<errc::errc_t>>;
|
template<class... T> using is_errc_t = std::is_same<mp11::mp_list<remove_cvref<T>...>, mp11::mp_list<errc::errc_t>>;
|
||||||
|
|
||||||
|
template<class T, class... A> struct is_constructible: std::is_constructible<T, A...> {};
|
||||||
|
template<class A> struct is_constructible<bool, A>: std::is_convertible<A, bool> {};
|
||||||
|
template<class A> struct is_constructible<bool const, A>: std::is_convertible<A, bool> {};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
// result
|
// result
|
||||||
@ -141,9 +145,9 @@ public:
|
|||||||
|
|
||||||
// explicit, value
|
// explicit, value
|
||||||
template<class... A, class En = typename std::enable_if<
|
template<class... A, class En = typename std::enable_if<
|
||||||
std::is_constructible<T, A...>::value &&
|
detail::is_constructible<T, A...>::value &&
|
||||||
!(detail::is_errc_t<A...>::value && std::is_arithmetic<T>::value) &&
|
!(detail::is_errc_t<A...>::value && std::is_arithmetic<T>::value) &&
|
||||||
!std::is_constructible<E, A...>::value &&
|
!detail::is_constructible<E, A...>::value &&
|
||||||
sizeof...(A) >= 1
|
sizeof...(A) >= 1
|
||||||
>::type>
|
>::type>
|
||||||
explicit constexpr result( A&&... a )
|
explicit constexpr result( A&&... a )
|
||||||
@ -154,8 +158,8 @@ public:
|
|||||||
|
|
||||||
// explicit, error
|
// explicit, error
|
||||||
template<class... A, class En2 = void, class En = typename std::enable_if<
|
template<class... A, class En2 = void, class En = typename std::enable_if<
|
||||||
!std::is_constructible<T, A...>::value &&
|
!detail::is_constructible<T, A...>::value &&
|
||||||
std::is_constructible<E, A...>::value &&
|
detail::is_constructible<E, A...>::value &&
|
||||||
sizeof...(A) >= 1
|
sizeof...(A) >= 1
|
||||||
>::type>
|
>::type>
|
||||||
explicit constexpr result( A&&... a )
|
explicit constexpr result( A&&... a )
|
||||||
|
Reference in New Issue
Block a user