Connecting Tech Pros Worldwide Help | Site Map

problem with unary_compose

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 16th, 2008, 09:55 AM
Lutz Altmann
Guest
 
Posts: n/a
Default problem with unary_compose

hi :)

i'm trying to use the "functional extensions" of the stl.
having a "problem" with the unary_compose..
The following code seems right to me, but doesnt compile -
if i declare "operator()" of "struct one" as const it works - but
i dont understand why it has to be static .. ?!

#include <functional>
#include <iostream>

#include <ext/functional>

using namespace std;
using namespace __gnu_cxx;

struct one: public unary_function<int, int>
{

int operator()(int arg)
{
return ++arg;
}

};

int main(int argc, char** argv) {

one o1,o2;
int i = 2;

unary_compose<one,onefunc = compose1(o1,o2);

cout<<func(i)<<endl;

return (EXIT_SUCCESS);
}

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.