C++ lambda expression generation: Passing parameters by reference to match Scala semantics