diff options
author | Brad King <brad.king@kitware.com> | 2020-08-27 15:12:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-08-27 15:13:20 (GMT) |
commit | 9fbd3df21e4059f97a683922635b4b70c8465b3f (patch) | |
tree | 7c2d67d23d5e049399515b99c5627885d017daef | |
parent | 09507da00a346289e1d9e257cceb2b2681ecd85b (diff) | |
parent | d2f891288ac2b3b4fd96bb0ddf829869513c5e4a (diff) | |
download | CMake-9fbd3df21e4059f97a683922635b4b70c8465b3f.zip CMake-9fbd3df21e4059f97a683922635b4b70c8465b3f.tar.gz CMake-9fbd3df21e4059f97a683922635b4b70c8465b3f.tar.bz2 |
Merge branch 'backport-3.17-cmext-vs16-declval' into release-3.17
Merge-request: !4971
-rw-r--r-- | Utilities/std/cmext/memory | 17 |
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()); |