[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] enable_if boost to std rosetta stone
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] enable_if boost to std rosetta stone |
Date: |
Mon, 23 Jan 2017 02:56:37 +0100 |
On Sun, 22 Jan 2017 20:46:47 +0000 Greg Chicares <address@hidden> wrote:
GC> Can't we get rid of both "::value" (as boost::enable_if does) and
GC> "::type" (as C++14 std::enable_if_t does) at the same time?
I don't see why not... At least my first naïve attempt to do it seems to
have compiled just fine:
---------------------------------- >8 --------------------------------------
diff --git a/input_seq_helpers.hpp b/input_seq_helpers.hpp
index c940545..7872568 100644
--- a/input_seq_helpers.hpp
+++ b/input_seq_helpers.hpp
@@ -97,12 +97,15 @@ namespace detail
}
}
}
+
+ template<typename IsTrue, typename T = void>
+ using enable_if_t = typename std::enable_if<IsTrue::value,T>::type;
} // namespace detail
template<typename T>
std::vector<T> convert_vector_type
(std::vector<mc_enum<T> > const& ve
- ,typename std::enable_if<std::is_enum<T>::value>::type* = nullptr
+ ,typename detail::enable_if_t<std::is_enum<T>>* = nullptr
)
{
std::vector<T> z;
---------------------------------- >8 --------------------------------------
I am not sure how to test this, but it looks like this ought to do the
right thing, am I missing something?
VZ