Skip to content

Commit

Permalink
Merge branch 'work'
Browse files Browse the repository at this point in the history
  • Loading branch information
oktonion committed Aug 2, 2018
2 parents 426d63b + 8d51966 commit 397b94c
Showing 1 changed file with 55 additions and 8 deletions.
63 changes: 55 additions & 8 deletions stdex/include/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ namespace stdex

//typedef void void_type;

// SFINAE magic

typedef char _yes_type;
struct _no_type
{
char padding[8];
};

template<class _B1 = void_type, class _B2 = void_type, class _B3 = void_type, class _B4 = void_type>
struct _or_ :
public conditional<_B1::value, _B1, _or_<_B2, _or_<_B3, _B4> > >::type
Expand Down Expand Up @@ -652,6 +660,9 @@ namespace stdex
public alignment_of<detail::_long_double_wrapper>
{};

template<class _Tp>
struct is_function;

namespace detail
{
template<class>
Expand All @@ -662,6 +673,47 @@ namespace stdex
struct _is_void_helper<void>
: public true_type { };

template<class _Tp>
_Tp (&_is_incomplete_type_tester_helper(int))[1];
template<class _Tp>
void* _is_incomplete_type_tester_helper(...);

_yes_type _is_incomplete_type_tester(void*);
template<class _Tp>
_no_type _is_incomplete_type_tester(_Tp(&)[1]);

template<class _Tp>
struct _is_incomplete_type_helper
{
static const bool value = sizeof(_is_incomplete_type_tester(_is_incomplete_type_tester_helper<_Tp>(0))) == sizeof(_yes_type);
};

template<class _Tp>
struct _is_incomplete_type
{
static const bool value = _is_incomplete_type_helper<_Tp>::value;
typedef integral_constant<bool, _is_incomplete_type_helper<_Tp>::value == bool(true)> type;
};

template<>
struct _is_incomplete_type<void>:
false_type
{ };

template<class _Tp, bool ImplCh = _is_incomplete_type<char[]>::value>
struct _is_array_impl:
_and_<_is_incomplete_type<_Tp>, _not_<is_function<_Tp> > >::type
{ };

template<class _Tp>
struct _is_array_impl<_Tp, false>:
false_type
{ };

template<class _Tp>
struct _is_array_impl<_Tp[], false> :
true_type
{ };
}

// is_void
Expand All @@ -671,9 +723,10 @@ namespace stdex
{ };

// is_array
template<class>
template<class _Tp>
struct is_array :
public false_type { };
public detail::_is_array_impl<typename remove_cv<_Tp>::type>
{ };

template<class _Tp, std::size_t _Size>
struct is_array<_Tp[_Size]> :
Expand Down Expand Up @@ -818,13 +871,7 @@ namespace stdex
template <class R, class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class T11, class T12, class T13, class T14, class T15, class T16, class T17, class T18, class T19, class T20, class T21, class T22, class T23, class T24>
struct _is_function_ptr_helper<R(*)(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24 ...)> : true_type {};

// SFINAE magic

typedef char _yes_type;
struct _no_type
{
char padding[8];
};

#define _IS_MEM_FUN_PTR_CLR \
template <class R, class T TYPES > \
Expand Down

0 comments on commit 397b94c

Please sign in to comment.