summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-06 13:42:21 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-06 13:42:21 (GMT)
commit2e029b1d360261f2fd8cdd06605149a87af77848 (patch)
tree6fd15663b97ee304682cfddcf2b39b8d7e89c932 /Utilities
parent948925f4161265d28676b6034c57e8e41f3801f8 (diff)
parent8843946519294d060a4a287ff89b78531075511f (diff)
downloadCMake-2e029b1d360261f2fd8cdd06605149a87af77848.zip
CMake-2e029b1d360261f2fd8cdd06605149a87af77848.tar.gz
CMake-2e029b1d360261f2fd8cdd06605149a87af77848.tar.bz2
Merge branch 'cmext-vs16-declval' into release-3.18
Merge-request: !4971
Diffstat (limited to 'Utilities')
-rw-r--r--Utilities/std/cmext/memory17
1 files changed, 9 insertions, 8 deletions
diff --git a/Utilities/std/cmext/memory b/Utilities/std/cmext/memory
index 50e79df..fa326f0 100644
--- a/Utilities/std/cmext/memory
+++ b/Utilities/std/cmext/memory
@@ -12,18 +12,19 @@
namespace cm {
-template <typename T, typename O,
- cm::enable_if_t<
- std::is_pointer<cm::invoke_result_t<decltype(&O::get), O>>::value,
- int> = 0>
+template <
+ typename T, typename O,
+ cm::enable_if_t<std::is_pointer<decltype(std::declval<O>().get())>::value,
+ int> = 0>
T& static_reference_cast(O& item)
{
return *(static_cast<T*>(item.get()));
}
-template <typename T, typename O,
- cm::enable_if_t<
- std::is_pointer<cm::invoke_result_t<decltype(&O::get), O>>::value,
- int> = 0>
+
+template <
+ typename T, typename O,
+ cm::enable_if_t<std::is_pointer<decltype(std::declval<O>().get())>::value,
+ int> = 0>
T& dynamic_reference_cast(O& item)
{
auto p = dynamic_cast<T*>(item.get());