fork(1) download
  1. #include <iomanip>
  2. #include <iostream>
  3. #include <type_traits>
  4.  
  5. using namespace std;
  6.  
  7. template <typename T>
  8. using function_ptr = typename std::add_pointer<typename std::enable_if<std::is_function<T>::value,T>::type>::type;
  9.  
  10.  
  11. namespace detail{
  12.  
  13. template<typename T, std::size_t S>
  14. struct array_helper{
  15. typedef T type[S];
  16. };
  17.  
  18. template<typename T>
  19. struct array_helper<T,0>{
  20. typedef T type[];
  21. };
  22.  
  23. }
  24.  
  25. template <typename T, std::size_t S = 0>
  26. using c_array = typename detail::array_helper<T,S>::type;
  27.  
  28.  
  29. int main(int /*argc*/, c_array<char*> /*argv*/)
  30. {
  31. typedef char*(*(*t1)(int (*)(char* , char* )))[];
  32. typedef function_ptr<c_array<char*>*(function_ptr<int(char*,char*)>)> t2;
  33.  
  34. cout << boolalpha << is_same<t1,t2>::value << endl;
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
true