Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
memfunref.cpp
Go to the documentation of this file.
1
30#include <algorithm> // for for_each
31#include <functional> // for mem_fun_ref
32#include <iostream> // for cout, endl
33
34#include <examples.h>
35#include <memfunref.h>
36
38
39int main ()
40{
41 list_type::value_type a1[] = { 2, 1, 5, 6, 4 };
42 list_type::value_type a2[] = { 11, 4, 67, 3, 14 };
43
44 list_type s1 (a1, a1 + sizeof a1 / sizeof *a1);
45 list_type s2 (a2, a2 + sizeof a2 / sizeof *a2);
46
47 // Build a list of sublists
48 typedef std::list<list_type, std::allocator<list_type> > list_list;
49
50 list_list l;
51 l.insert (l.begin (), s1);
52 l.insert (l.begin (), s2);
53
54 // Sort each sublist in the list
55 std::for_each (l.begin (), l.end (), std::mem_fun_ref (&list_type::sort));
56
57 // Display the contents of list
58 std::for_each (l.begin (), l.end (), std::mem_fun_ref (&list_type::disp));
59
60 return 0;
61}
62
#define s1
Definition 17.names.cpp:242
#define s2
Definition 17.names.cpp:268
#define a2
Definition 17.names.cpp:251
#define a1
Definition 17.names.cpp:225
int sort()
Definition memfunref.h:58
list_type::value_type value_type
Definition memfunref.h:47
int disp() const
Definition memfunref.h:63
sublist< int > list_type
Definition memfunref.cpp:37
int main()
Definition memfunref.cpp:39