Home What is the difference between int () and int (*)()?
Reply: 0

What is the difference between int () and int (*)()?

user1384 Published in March 22, 2018, 9:14 pm

I'm trying to create a class template that identifies functions, in which I can identify when a function is specializing the class model for R (*) (), but in std::function you can declare return_type (), and std::is_same< int(), int (*) () >.::value is zero.

What does this int () statement mean and what is the difference between int () and
int (*) ()

Updated: So int () is function declaration or function type and int (*)() is pointer to function.But waht is the type function of int (std::string::)()?It's something like int std::string::(), or like in std::function int(const std::string&)?How i can make this program output 1?

#include <iostream>
template<typename A,typename B>
struct IsSame{
      value = 0};
template<typename A>
struct IsSame<A,A>{
        value = 1  
typedef int (SumType)(int,int)const;
class X{
        SumType sum;    
int X::sum(int a,int b)const{
    return a+b;

int main()
  std::cout << IsSame< int (const std::string&,int,int)const,
                       decltype( &X::sum)>::value;

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302816 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO