未验证 提交 28ef0fff 编写于 作者: L Leding Li 提交者: GitHub

Fix build on gcc-11 (#46808)

* Add missing <cstddef>
  * Fix some iterator type
  * Currently use host protobuf to bypass build failure
上级 09fae5cd
......@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <cstddef>
#include <cstdint>
#include <unordered_map>
......
......@@ -761,7 +761,7 @@ PyObject* ToPyObject(const void* value) {
PyObject* ToPyObject(
const std::unordered_map<std::string, std::vector<std::string>>& value) {
PyObject* dict = PyDict_New();
for (const auto map_iter : value) {
for (const auto& map_iter : value) {
// Convert Key
PyObject* key_string = PyUnicode_FromString(map_iter.first.c_str());
if (!key_string) {
......@@ -771,7 +771,7 @@ PyObject* ToPyObject(
// Convert Val
PyObject* py_list = PyList_New(0);
for (const auto vector_iter : map_iter.second) {
for (const auto& vector_iter : map_iter.second) {
PyObject* val_string = PyUnicode_FromString(vector_iter.c_str());
if (!val_string) {
PADDLE_THROW(platform::errors::Fatal(
......@@ -798,7 +798,7 @@ PyObject* ToPyObject(
PyObject* ToPyObject(const std::unordered_map<std::wstring, int>& value) {
PyObject* dict = PyDict_New();
for (const auto map_iter : value) {
for (const auto& map_iter : value) {
// Convert Key
PyObject* key_string =
PyUnicode_FromWideChar(map_iter.first.c_str(), map_iter.first.size());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册