Multiple desktops, multitasking, Mozilla based browser, desktop widgets, cool UI, speed all seems to be best of what other OS has to offer. And guess what, it runs on Linux. The Symbian OS 9.4, Windows Mobile 6.5 or iPhone OS 3.. all seem to be moving ahead somewhat slowly. Comparing to them, Maemo 5 seems to be a leap ahead. It seems to be the next best thing after iPhone OS 1 came out thousands of years ago :).
Nokia will release N900 in a few months, the company's first phone running on Maemo 5. N900 itself has good spec with 600 MHz ARM processor, 256 MB RAM, 32 GB ROM, high-end cam, etc.
You can check more about Maemo at: http://maemo.nokia.com/ and more about N900 at http://maemo.nokia.com/n900/.
Posted by Mohammad Kaisar Ul Haque at 3:35 AM 3 comments Links to this post
Labels: linux, mobile applications
Wednesday, February 18, 2009
C++: Pointer to members
Pointer to member operators are not an everyday operators that we use but those can be useful if used in the correct way. Pointer to member operator ::* is used to declare a pointer that points to a member variable, pointer or function of a class. The operators .* and ->* are used to access it.
Following is an example of how we can use Pointer to member function (also called member function pointer).
1 #include
2 using namespace std;
3
4 class A{
5 public:
6 A(){
7 }
8 int Func(int a){
9 return a * 2;
10 }
11
12 };
13
14 int main(){
15 int (A::*fp)(int) = &A::Func;
16
17 A a;
18 cout << (a.*fp)(10) << endl; 19 20 return 0; 21 } 22 Following is another (almost random) example of how we can write generic classes to wrap pointer to member function to use with multiple classes. 1 #include
2 using namespace std;
3
4 class A{
5 public:
6 int Func1(int a){
7 return a * 2;
8 }
9
10 };
11
12 class B{
13 public:
14 int Func2(int a){
15 return a / 2;
16 }
17
18 };
19
20 template
21 class MemFnPtr
22 {
23 public:
24 MemFnPtr(int (T::*fp)(int), T &t) : m_fp(fp), m_t(t){
25 }
26 int Fn(int n)
27 {
28 return ((m_t).*(m_fp))(n);
29 }
30
31 //member vars
32 int (T::*m_fp)(int);
33 T &m_t;
34 };
35
36 int main(){
37 A a_obj;
38
39 MemFnPtr fp_a(&A::Func1, a_obj);
40 cout << fp_a.Fn(10) << endl; 41 42 B b_obj; 43 44 MemFnPtr fp_b(&B::Func2, b_obj);
45 cout << fp_b.Fn(10) << endl;
46
47 return 0;
48 }
49
No comments:
Post a Comment