1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix is_convert_constructible

This commit is contained in:
bolero-MURAKAMI 2014-04-05 10:16:16 +09:00
parent e244ea2932
commit 5bfb5087ac
2 changed files with 7 additions and 6 deletions

View file

@ -21,8 +21,7 @@ namespace sprout {
template<typename T>
struct is_convert_constructible_test {
public:
template<typename To = T>
static sprout::true_type test(To);
static sprout::true_type test(T);
static sprout::false_type test(...);
};
} // namespace detail
@ -32,8 +31,8 @@ namespace sprout {
{};
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>
SPROUT_STATIC_CONSTEXPR bool is_convert_constructible_v = sprout::is_convert_constructible<T>::value;
template<typename T, typename Arg>
SPROUT_STATIC_CONSTEXPR bool is_convert_constructible_v = sprout::is_convert_constructible<T, Arg>::value;
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
} // namespace sprout

View file

@ -15,6 +15,8 @@
#include <sprout/iterator/prev.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/utility/swap.hpp>
#include <sprout/type_traits/is_convert_constructible.hpp>
#include <sprout/type_traits/enabler_if.hpp>
namespace testspr {
//
@ -47,11 +49,11 @@ namespace testspr {
explicit SPROUT_CONSTEXPR reduct_iterator(iterator_type 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)
: 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 temp(it);
temp.swap(*this);