Why I am getting Error C2091: function returns function 
Author Message
 Why I am getting Error C2091: function returns function

Hi y'all,

When I compile following code snippet I get error error C2091 (function
returns function). I am not sure why its giving me that erorr. The functor
looks fine to me. The offending line is 'int operator () ()'. I am using
VC++ 6.0 SP4 on NT.

#include <algorithm>
#include <list>

using namespace std;

class Generate
{
public:
 Generate() : value(0) {}
 Generate(int n) : value(n) {}

 int operater() ()
 {
  return value++;
 }

private:
 int value;

Quote:
};

int main()
{
 list<int> nlist;

 generate_n(back_inserter(nlist), 11, Generate(1));

 return 0;

Quote:
}

Thanks for your help,
Vikas


Sun, 09 Nov 2003 06:18:52 GMT  
 Why I am getting Error C2091: function returns function
It's "operator()()" not "operater"
--
With best wishes,
    Igor Tandetnik


Quote:
> Hi y'all,

> When I compile following code snippet I get error error C2091 (function
> returns function). I am not sure why its giving me that erorr. The functor
> looks fine to me. The offending line is 'int operator () ()'. I am using
> VC++ 6.0 SP4 on NT.

> #include <algorithm>
> #include <list>

> using namespace std;

> class Generate
> {
> public:
>  Generate() : value(0) {}
>  Generate(int n) : value(n) {}

>  int operater() ()
>  {
>   return value++;
>  }

> private:
>  int value;
> };

> int main()
> {
>  list<int> nlist;

>  generate_n(back_inserter(nlist), 11, Generate(1));

>  return 0;
> }

> Thanks for your help,
> Vikas



Sun, 09 Nov 2003 06:46:53 GMT  
 Why I am getting Error C2091: function returns function
Grrr. How can I be so stupid? Thanks Igor.

Vikas


Quote:
> It's "operator()()" not "operater"
> --
> With best wishes,
>     Igor Tandetnik



> > Hi y'all,

> > When I compile following code snippet I get error error C2091 (function
> > returns function). I am not sure why its giving me that erorr. The
functor
> > looks fine to me. The offending line is 'int operator () ()'. I am using
> > VC++ 6.0 SP4 on NT.

> > #include <algorithm>
> > #include <list>

> > using namespace std;

> > class Generate
> > {
> > public:
> >  Generate() : value(0) {}
> >  Generate(int n) : value(n) {}

> >  int operater() ()
> >  {
> >   return value++;
> >  }

> > private:
> >  int value;
> > };

> > int main()
> > {
> >  list<int> nlist;

> >  generate_n(back_inserter(nlist), 11, Generate(1));

> >  return 0;
> > }

> > Thanks for your help,
> > Vikas



Mon, 10 Nov 2003 01:51:41 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie:- Why am i getting a linking error

2. Don't understand why I am getting the C2236 error

3. Why am I getting this error - compiler bug?

4. Pointer to function returning pointer to function returning...

5. Macro with functions problem -- why am I stupid?

6. Why won't this function return a value

7. Help - Why does my function only return 9 chars

8. Why InetIsOffline function always return FALSE?

9. function return : why const reference ?

10. Why am I getting an ExecutionEngineException?

11. Why am I not getting correct position?

12. Why am I getting a segmentation fault?

 

 
Powered by phpBB® Forum Software