[libcxx-commits] [libcxx] [libc++] Implement LWG3528 (`make_from_tuple` can perform (the equivalent of) a C-style cast) (PR #85263)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 18 06:43:41 PDT 2024


================
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14
----------------
yronglin wrote:

Agree, but current implementation in this PR seems not SFINAE friendly, there some hard errors. I'm trying to solve these problems. 
```
template <class T, class Tuple, class = std::void_t<>>
struct can_make_from_tuple : std::false_type {};

template <class T, class Tuple>
struct can_make_from_tuple<
    T,
    Tuple,
    std::void_t<decltype(std::make_from_tuple<T>(std::declval<Tuple>()))>>
    : std::true_type {};

static_assert(!can_make_from_tuple<char*, std::tuple<const char*>>::value);
```

https://github.com/llvm/llvm-project/pull/85263


More information about the libcxx-commits mailing list