Could you, please, give an idea how to implement basic lambda expressions in C++03 without special libraries, in a simple, elegant and smart way? They should make it possible to do something like this:
for_each(some_vector.begin(), some_vector.end(), _first = -5)
sort(some_vector.begin(), some_vector.end(), _first > _last)
I have seen many topics on StackOverflow and in other places in the Internet, but, unfortunately, I didn’t find something useful. Another idea is to look into Boost implementation carefully, but, sadly, my level is not very appropriate for it now.
Thank you in advance!
AFAIK, the most common implementation technique for lambdas are expression templates.
This article gives an excellent introduction but you should really get one of the books on C++ TMP to get some further insight.