GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 31-Oct-2003, 15:13
yosep yosep is offline
New Member
 
Join Date: Oct 2003
Posts: 1
yosep is an unknown quantity at this point

STL (algorithm): for_each problem


Hello...

I am trying to compile a program, however, the following section of the code gives me an error.
CPP / C++ / C Code:
void sig::kill (int signo)
{
  phndlist& v = smap [signo];

  struct procsig {
    int signo;
    procsig (int s): signo (s) {}
    void operator () (phnd& ph) { (*ph) (signo); }
  };

  for_each (v.begin (), v.end (), procsig (signo));  //<--TROUBLE
}

And, the error is:

sig.C: In method `void sig::kill(int)':
sig.C:171: type `sig::kill(int)::procsig' composed from a local class is not a valid template-argument

How can I go about fixing this??? Do I need to creaete another class that may contain the struct procsig??? I am very confused.
Thank you very much in advance.
  #2  
Old 03-Nov-2003, 11:36
Garth Farley Garth Farley is offline
Invalid Email Address
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
It must be the fact that the procsig class is not available outside the function, to the for_each() function. I suggest you declare this struct at the top of the class, so it's available to all members of the class.

GF
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with php5 cgi installation fab13 Apache Web Server Forum 3 19-Nov-2003 09:11
unwanted scrollbar problem kelly001 Web Design Forum 3 24-Oct-2003 10:44
problem with creating class mohammed C++ Forum 1 11-Oct-2003 09:04
folder problem in trees zuzupus MySQL / PHP Forum 23 26-Sep-2003 07:32
join problem zuzupus MySQL / PHP Forum 0 14-Aug-2003 05:11

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:39.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.