[wip] More patching to fix up linking issue.
[wip] c++: Used std::for_each instead of ranged for loop.