Commit b5f590c2 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Cut non-const conversion overloads from Range

Summary: [Folly] Cut non-`const` conversion overloads from `Range`, for both `operator T` and `to<T>`: let them be `const` member functions so that the converted-to object cannot update `Range` internal state.

Reviewed By: terrelln, vitaut

Differential Revision: D8921428

fbshipit-source-id: eefc14b5fe2033cac43ebc274b27bdea95388488
parent 46c141a8
......@@ -474,14 +474,6 @@ class Range {
return detail::value_before(e_);
}
template <
typename Tgt,
std::enable_if_t<std::is_constructible<Tgt, Iter&, Iter&>::value, int> =
0>
FOLLY_CPP14_CONSTEXPR explicit operator Tgt() noexcept(
noexcept(Tgt(std::declval<Iter&>(), std::declval<Iter&>()))) {
return Tgt(b_, e_);
}
template <
typename Tgt,
std::enable_if_t<
......@@ -492,18 +484,6 @@ class Range {
return Tgt(b_, e_);
}
template <typename Tgt, typename... Args>
FOLLY_CPP14_CONSTEXPR auto to(Args&&... args) noexcept(noexcept(
Tgt(std::declval<Iter&>(),
std::declval<Iter&>(),
static_cast<Args&&>(args)...)))
-> decltype(
Tgt(std::declval<Iter&>(),
std::declval<Iter&>(),
static_cast<Args&&>(args)...)) {
return Tgt(b_, e_, static_cast<Args&&>(args)...);
}
template <typename Tgt, typename... Args>
constexpr auto to(Args&&... args) const noexcept(noexcept(
Tgt(std::declval<Iter const&>(),
......
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