Created
February 2, 2019 16:56
-
-
Save outro56/3308d886026b21c62a3c65fcbe099f06 to your computer and use it in GitHub Desktop.
Revisions
-
outro56 created this gist
Feb 2, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ template<typename T, typename U> using assign_expression = decltype(std::declval<T&>() = std::declval<U&>()); template<typename T, typename U> constexpr bool is_assignable = is_detected<assign_expression, T, U>; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ template<typename...> using try_to_instantiate = void; using disregard_this = void; template<template<typename...> class Expression, typename Attempt, typename... Ts> struct is_detected_impl : std::false_type{}; template<template<typename...> class Expression, typename... Ts> struct is_detected_impl<Expression, try_to_instantiate<Expression<Ts...>>, Ts...> : std::true_type{}; template<template<typename...> class Expression, typename... Ts> constexpr bool is_detected = is_detected_impl<Expression, disregard_this, Ts...>::value;