- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
#include <type_traits>
struct TPred1 {};
struct TPred2 {};
template<typename P1, typename P2> struct TAnd1: P1, P2 {TAnd1(P1, P2) {}};
template<typename P1, typename P2> struct TAnd2: P1, P2 {TAnd2(P1, P2) {}};
template<typename T, T v> struct my_integral_constant {enum {value=v};};
template<class T, class From> struct my_is_base_of:
my_integral_constant<bool, __is_base_of(T, From)> {};
template<typename P1, typename P2> std::enable_if_t<
my_is_base_of<TPred1, P1>::value &&
my_is_base_of<TPred1, P2>::value,
TAnd1<P1, P2>> operator&&(P1 p1, P2 p2)
{return {p1, p2};}
template<typename P1, typename P2> std::enable_if_t<
my_is_base_of<TPred2, P1>::value &&
my_is_base_of<TPred2, P2>::value,
TAnd2<P1, P2>> operator&&(P1 p1, P2 p2)
{return {(p1, p2};}
template<typename T> struct is_callable
{
template<typename T1> struct dummy;
template<typename CheckType> static short check(dummy<decltype(
std::declval<std::remove_reference_t<CheckType>>()())>*);
template<typename CheckType> static char check(...);
enum: bool {value = sizeof(check<T>(nullptr)) == sizeof(short)};
};
struct IntellisenseKiller
{
template<typename T, typename = std::enable_if_t<
std::is_function<T>::value &&
is_callable<T>::value
>> IntellisenseKiller(const T&) {}
IntellisenseKiller(bool) {}
};
IntellisenseKiller eat4GbRam = true;