// // XToolsCommon.h // cpp_tests // // Created by jief on 25.04.20. // Copyright © 2020 JF Knudsen. All rights reserved. // #ifndef XToolsCommon_h #define XToolsCommon_h struct XStringAbstract__false_type { static constexpr bool value = false; bool v() const { return false; } }; struct XStringAbstract__true_type { static constexpr bool value = true; bool v() const { return true; } }; /* make unsigned */ template struct XStringAbstract__make_unsigned {}; template <> struct XStringAbstract__make_unsigned< char> {typedef unsigned char type;}; template <> struct XStringAbstract__make_unsigned< signed char> {typedef unsigned char type;}; template <> struct XStringAbstract__make_unsigned {typedef unsigned char type;}; template <> struct XStringAbstract__make_unsigned< char16_t> {typedef char16_t type;}; template <> struct XStringAbstract__make_unsigned< char32_t> {typedef char32_t type;}; template <> struct XStringAbstract__make_unsigned< wchar_t> {typedef wchar_t type;}; template <> struct XStringAbstract__make_unsigned< signed short> {typedef unsigned short type;}; template <> struct XStringAbstract__make_unsigned {typedef unsigned short type;}; template <> struct XStringAbstract__make_unsigned< signed int> {typedef unsigned int type;}; template <> struct XStringAbstract__make_unsigned {typedef unsigned int type;}; template <> struct XStringAbstract__make_unsigned< signed long> {typedef unsigned long type;}; template <> struct XStringAbstract__make_unsigned {typedef unsigned long type;}; template <> struct XStringAbstract__make_unsigned< signed long long> {typedef unsigned long long type;}; template <> struct XStringAbstract__make_unsigned {typedef unsigned long long type;}; #define unsigned_type(x) typename XStringAbstract__make_unsigned::type /* enable_if */ template struct XStringAbstract__enable_if_t {}; template struct XStringAbstract__enable_if_t { typedef T type; }; //#define enable_if(x) XStringAbstract__enable_if_t(x, void)::type #define enable_if(x) typename enable_if_type = typename XStringAbstract__enable_if_t::type // //template< bool B, class T = void > //using XStringAbstract__enable_if_t = typename XStringAbstract__enable_if::type; // is_integral template struct XStringAbstract__is_integral_st : public XStringAbstract__false_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_integral_st : public XStringAbstract__true_type {}; #define is_integral(x) XStringAbstract__is_integral_st::value // is_char template struct XStringAbstract__is_char_st : public XStringAbstract__false_type {}; template <> struct XStringAbstract__is_char_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_st : public XStringAbstract__true_type {}; #define is_char(x) XStringAbstract__is_char_st::value // //// STRUCT TEMPLATE remove_reference //template // struct remove_ref // { // remove reference // using type = _Ty; // }; // //template // struct remove_ref<_Ty&> // { // remove reference // using type = _Ty; // }; // STRUCT TEMPLATE remove_const template struct remove_const { // remove const using type = _Ty; }; template struct remove_const { // remove const using type = _Ty; }; // is_char_ptr template struct XStringAbstract__is_char_ptr_st : public XStringAbstract__false_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; //template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; //template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template <> struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; template struct XStringAbstract__is_char_ptr_st : public XStringAbstract__true_type {}; #define is_char_ptr(x) XStringAbstract__is_char_ptr_st::type>::value #endif /* XToolsCommon_h */