Unverified Commit 857aba16 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #984

Fix conversion constructor for caf::span
parents 4c2c9871 06cfaf7d
......@@ -695,8 +695,8 @@ template <class T, class To>
class has_convertible_data_member {
private:
template <class U>
static auto sfinae(U* x)
-> decltype(std::declval<To*>() = x->data(), std::true_type());
static auto sfinae(U* x) -> std::integral_constant<
bool, std::is_convertible<decltype(x->data()), To*>::value>;
template <class U>
static auto sfinae(...) -> std::false_type;
......
......@@ -114,4 +114,10 @@ CAF_TEST(make_span) {
CAF_CHECK_EQUAL(begin(ys), begin(zs));
}
CAF_TEST(spans are convertible from compatible containers) {
std::vector<int> xs{1, 2, 3};
span<const int> ys{xs};
CAF_CHECK(std::equal(xs.begin(), xs.end(), ys.begin()));
}
CAF_TEST_FIXTURE_SCOPE_END()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment