Commit c65c0419 authored by kenton@google.com's avatar kenton@google.com

Fix issue 162: generated code should #include <algorithm> for std::swap().

parent daee0516
...@@ -287,7 +287,9 @@ void FileGenerator::GenerateSource(io::Printer* printer) { ...@@ -287,7 +287,9 @@ void FileGenerator::GenerateSource(io::Printer* printer) {
// want the compiler to warn in generated code. // want the compiler to warn in generated code.
"#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION\n" "#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION\n"
"#include \"$basename$.pb.h\"\n" "#include \"$basename$.pb.h\"\n"
"\n"
"#include <algorithm>\n" // for swap()
"\n"
"#include <google/protobuf/stubs/once.h>\n" "#include <google/protobuf/stubs/once.h>\n"
"#include <google/protobuf/io/coded_stream.h>\n" "#include <google/protobuf/io/coded_stream.h>\n"
"#include <google/protobuf/wire_format_lite_inl.h>\n", "#include <google/protobuf/wire_format_lite_inl.h>\n",
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/compiler/plugin.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/once.h> #include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h> #include <google/protobuf/wire_format_lite_inl.h>
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/once.h> #include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h> #include <google/protobuf/wire_format_lite_inl.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment