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