Why can lambdas be better optimized by the compiler than plain functions?

In his book The C++ Standard Library (Second Edition) Nicolai Josuttis states that lambdas can be better optimized by the compiler than plain functions. In addition, C++ compilers optimize lambdas better than they do ordinary functions. (Page 213) Why is that? I thought when it comes to inlining there shouldn’t be any difference any more. … Read more

Java 8: Lambda-Streams, Filter by Method with Exception

I have a problem trying out the Lambda expressions of Java 8. Usually it works fine, but now I have methods that throw IOException‘s. It’s best if you look at the following code: class Bank{ …. public Set<String> getActiveAccountNumbers() throws IOException { Stream<Account> s = accounts.values().stream(); s = s.filter(a -> a.isActive()); Stream<String> ss = s.map(a … Read more