Fixed the Generate function build failure.
Also avoided calling std::* functions directly.