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

pull/3335/head
kenton@google.com 15 years ago
parent daee05168e
commit c65c04195d
  1. 4
      src/google/protobuf/compiler/cpp/cpp_file.cc
  2. 3
      src/google/protobuf/compiler/plugin.pb.cc
  3. 3
      src/google/protobuf/descriptor.pb.cc

@ -287,7 +287,9 @@ void FileGenerator::GenerateSource(io::Printer* printer) {
// want the compiler to warn in generated code.
"#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION\n"
"#include \"$basename$.pb.h\"\n"
"\n"
"#include <algorithm>\n" // for swap()
"\n"
"#include <google/protobuf/stubs/once.h>\n"
"#include <google/protobuf/io/coded_stream.h>\n"
"#include <google/protobuf/wire_format_lite_inl.h>\n",

@ -2,6 +2,9 @@
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "google/protobuf/compiler/plugin.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>

@ -2,6 +2,9 @@
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "google/protobuf/descriptor.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>

Loading…
Cancel
Save