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

Use traits in Range conversion functions

Summary:
[Folly] Use traits in `Range` conversion functions.

Dependent code requires this for msvc2015.

Reviewed By: vitaut

Differential Revision: D8929559

fbshipit-source-id: dbf4afbebdf92ee4eb46067ff443980823cd771d
parent 98d3bec7
......@@ -487,7 +487,7 @@ class Range {
std::is_constructible<Tgt, Iter const&, Iter const&>::value,
int> = 0>
constexpr explicit operator Tgt() const noexcept(
noexcept(Tgt(std::declval<Iter const&>(), std::declval<Iter const&>()))) {
std::is_nothrow_constructible<Tgt, Iter const&, Iter const&>::value) {
return Tgt(b_, e_);
}
......@@ -505,14 +505,12 @@ class Range {
/// some specialization of std::vector or std::basic_string in a context which
/// requires a non-default-constructed allocator.
template <typename Tgt, typename... Args>
constexpr auto to(Args&&... args) const noexcept(noexcept(
Tgt(std::declval<Iter const&>(),
std::declval<Iter const&>(),
static_cast<Args&&>(args)...)))
-> decltype(
Tgt(std::declval<Iter const&>(),
std::declval<Iter const&>(),
static_cast<Args&&>(args)...)) {
constexpr std::enable_if_t<
std::is_constructible<Tgt, Iter const&, Iter const&>::value,
Tgt>
to(Args&&... args) const noexcept(
std::is_nothrow_constructible<Tgt, Iter const&, Iter const&, Args&&...>::
value) {
return Tgt(b_, e_, static_cast<Args&&>(args)...);
}
......
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