mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-14 10:39:05 +00:00
fix is_convert_constructible
This commit is contained in:
parent
e244ea2932
commit
5bfb5087ac
2 changed files with 7 additions and 6 deletions
|
@ -21,8 +21,7 @@ namespace sprout {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct is_convert_constructible_test {
|
struct is_convert_constructible_test {
|
||||||
public:
|
public:
|
||||||
template<typename To = T>
|
static sprout::true_type test(T);
|
||||||
static sprout::true_type test(To);
|
|
||||||
static sprout::false_type test(...);
|
static sprout::false_type test(...);
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@ -32,8 +31,8 @@ namespace sprout {
|
||||||
{};
|
{};
|
||||||
|
|
||||||
#if SPROUT_USE_VARIABLE_TEMPLATES
|
#if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
template<typename T>
|
template<typename T, typename Arg>
|
||||||
SPROUT_STATIC_CONSTEXPR bool is_convert_constructible_v = sprout::is_convert_constructible<T>::value;
|
SPROUT_STATIC_CONSTEXPR bool is_convert_constructible_v = sprout::is_convert_constructible<T, Arg>::value;
|
||||||
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
|
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include <sprout/iterator/prev.hpp>
|
#include <sprout/iterator/prev.hpp>
|
||||||
#include <sprout/iterator/distance.hpp>
|
#include <sprout/iterator/distance.hpp>
|
||||||
#include <sprout/utility/swap.hpp>
|
#include <sprout/utility/swap.hpp>
|
||||||
|
#include <sprout/type_traits/is_convert_constructible.hpp>
|
||||||
|
#include <sprout/type_traits/enabler_if.hpp>
|
||||||
|
|
||||||
namespace testspr {
|
namespace testspr {
|
||||||
//
|
//
|
||||||
|
@ -47,11 +49,11 @@ namespace testspr {
|
||||||
explicit SPROUT_CONSTEXPR reduct_iterator(iterator_type it)
|
explicit SPROUT_CONSTEXPR reduct_iterator(iterator_type it)
|
||||||
: current(it)
|
: current(it)
|
||||||
{}
|
{}
|
||||||
template<typename U, typename V>
|
template<typename U, typename V, typename sprout::enabler_if<sprout::is_convert_constructible<Iterator, U>::value>::type = sprout::enabler>
|
||||||
SPROUT_CONSTEXPR reduct_iterator(reduct_iterator<U, V> const& it)
|
SPROUT_CONSTEXPR reduct_iterator(reduct_iterator<U, V> const& it)
|
||||||
: current(it.base())
|
: current(it.base())
|
||||||
{}
|
{}
|
||||||
template<typename U, typename V>
|
template<typename U, typename V, typename sprout::enabler_if<sprout::is_convert_constructible<Iterator, U>::value>::type = sprout::enabler>
|
||||||
reduct_iterator& operator=(reduct_iterator<U, V> const& it) {
|
reduct_iterator& operator=(reduct_iterator<U, V> const& it) {
|
||||||
reduct_iterator temp(it);
|
reduct_iterator temp(it);
|
||||||
temp.swap(*this);
|
temp.swap(*this);
|
||||||
|
|
Loading…
Reference in a new issue