Development reference: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{| class="mw-collapsible mw-collapsed wikitable" | |||
! c++11 for loop using lambda | |||
|- | |||
| This for loop is clean and elegant and a perfect way to check if your compiler is ready for c++11: | |||
C++11 provides lambda functions, we should switch from iterators and functors to those | |||
but not quite yet, since we're writing cross-platform code | |||
start with trying to use this cool for_each loop with a lambda instead of the traditional for-with-increment loop: | |||
vector<int> v; | |||
for_each( v.begin(), v.end(), [] (int val) | |||
{ | |||
cout << val; | |||
} ); | |||
do not touch this tho until we can be sure that all platforms provide compatible C++11 handling | |||
max os x snow leopard does not understand the lambda function | |||
|} | |||
{| class="mw-collapsible mw-collapsed wikitable" | {| class="mw-collapsible mw-collapsed wikitable" | ||
! c++ stl in-memory storage of "major" objects | ! c++ stl in-memory storage of "major" objects | ||
Line 32: | Line 50: | ||
BUT... you can provide a FUNCTOR to do the job, then provide it when sorting/searching | BUT... you can provide a FUNCTOR to do the job, then provide it when sorting/searching | ||
a functor is basically a structure with a bool operator()(const MyObjectPtr* left, const MyObjectPtr* right) | a functor is basically a structure with a bool operator()(const MyObjectPtr* left, const MyObjectPtr* right) | ||
once c++11 is ready, consider using lambda functions instead | |||
|} | |} | ||
Revision as of 02:19, 1 October 2012
Expandc++11 for loop using lambda |
---|
Expandc++ stl in-memory storage of "major" objects |
---|
Expandc++ stl reverse iterator skeleton |
---|
c++ stl reading a binary file |
---|
Expandc/c++ gdb debugging |
---|
Expandphp debugging |
---|
Expandjava eclipse project layout format |
---|
Expandmediawiki collapsible skeleton |
---|
Expandmediawiki collapsible example |
---|
Web Services |
---|
Firefox Addon development |
---|