Click here to Skip to main content
15,903,201 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTransparency of controls Pin
damir_tk21-Nov-06 10:37
damir_tk21-Nov-06 10:37 
AnswerRe: Transparency of controls Pin
damir_tk21-Nov-06 11:30
damir_tk21-Nov-06 11:30 
GeneralRe: Transparency of controls Pin
Mark Salsbery21-Nov-06 11:46
Mark Salsbery21-Nov-06 11:46 
GeneralRe: Transparency of controls Pin
damir_tk21-Nov-06 12:07
damir_tk21-Nov-06 12:07 
GeneralRe: Transparency of controls Pin
Mark Salsbery21-Nov-06 13:58
Mark Salsbery21-Nov-06 13:58 
Questiondirectks in video capture? Pin
yongwpi21-Nov-06 9:16
yongwpi21-Nov-06 9:16 
QuestionProblem with for_each function Pin
WillemM21-Nov-06 8:52
WillemM21-Nov-06 8:52 
AnswerRe: Problem with for_each function Pin
Maximilien21-Nov-06 9:29
Maximilien21-Nov-06 9:29 
(copy pasted from the SGI stl pages.
template<class T> struct print : public unary_function<T, void>
{
  print(ostream& out) : os(out), count(0) {}
  void operator() (T x) { os << x << ' '; ++count; }
  ostream& os;
  int count;
};

int main()
{
  int A[] = {1, 4, 2, 8, 5, 7};
  const int N = sizeof(A) / sizeof(int);

  print<int> P = for_each(A, A + N, print<int>(cout));
  cout << endl << P.count << " objects printed." << endl;
}


for_each will loop the elements in the sequence ( bounded by the range ), and apply the operator to each element and then returns the count.

in this case, it will print each item in the array.

it's a shortcut to a normal for loop.



Maximilien Lincourt
Your Head A Splode - Strong Bad

GeneralRe: Problem with for_each function Pin
WillemM21-Nov-06 10:19
WillemM21-Nov-06 10:19 
GeneralRe: Problem with for_each function Pin
Maximilien21-Nov-06 10:38
Maximilien21-Nov-06 10:38 
GeneralRe: Problem with for_each function Pin
Stephen Hewitt21-Nov-06 11:42
Stephen Hewitt21-Nov-06 11:42 
QuestionMember function with a const parm Pin
Reagan Conservative21-Nov-06 7:53
Reagan Conservative21-Nov-06 7:53 
AnswerRe: Member function with a const parm Pin
CPallini21-Nov-06 8:12
mveCPallini21-Nov-06 8:12 
AnswerRe: Member function with a const parm Pin
David Crow21-Nov-06 8:13
David Crow21-Nov-06 8:13 
AnswerRe: Member function with a const parm Pin
Reagan Conservative21-Nov-06 8:14
Reagan Conservative21-Nov-06 8:14 
AnswerRe: Member function with a const parm Pin
Michael Dunn21-Nov-06 8:33
sitebuilderMichael Dunn21-Nov-06 8:33 
Questionhow to create a text box? Pin
bosstroy21-Nov-06 6:13
bosstroy21-Nov-06 6:13 
AnswerRe: how to create a text box? Pin
super_ttd21-Nov-06 6:18
super_ttd21-Nov-06 6:18 
AnswerRe: how to create a text box? Pin
Waldermort21-Nov-06 6:42
Waldermort21-Nov-06 6:42 
GeneralRe: how to create a text box? Pin
Paul Conrad21-Nov-06 16:21
professionalPaul Conrad21-Nov-06 16:21 
GeneralRe: how to create a text box? Pin
ThatsAlok21-Nov-06 17:57
ThatsAlok21-Nov-06 17:57 
QuestionMFC Class Wizard in Visual Studio 2005 Pin
ilgale21-Nov-06 5:53
ilgale21-Nov-06 5:53 
AnswerRe: MFC Class Wizard in Visual Studio 2005 Pin
led mike21-Nov-06 5:56
led mike21-Nov-06 5:56 
AnswerRe: MFC Class Wizard in Visual Studio 2005 Pin
David Crow21-Nov-06 8:15
David Crow21-Nov-06 8:15 
QuestionIndexed Sequential library - flat 'C Pin
spring pizza21-Nov-06 5:11
spring pizza21-Nov-06 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.