diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 719771eb2..0784e7817 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -775,8 +775,8 @@ TEST_F(CommandLineInterfaceTest, WriteTransitiveDescriptorSet) { if (HasFatalFailure()) return; ASSERT_EQ(2, descriptor_set.file_size()); if (descriptor_set.file(0).name() == "bar.proto") { - swap(descriptor_set.mutable_file()->mutable_data()[0], - descriptor_set.mutable_file()->mutable_data()[1]); + std::swap(descriptor_set.mutable_file()->mutable_data()[0], + descriptor_set.mutable_file()->mutable_data()[1]); } EXPECT_EQ("foo.proto", descriptor_set.file(0).name()); EXPECT_EQ("bar.proto", descriptor_set.file(1).name()); diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index d294e5873..e04b93cc4 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -324,7 +324,7 @@ void GeneratedMessageReflection::Swap( int has_bits_size = (descriptor_->field_count() + 31) / 32; for (int i = 0; i < has_bits_size; i++) { - swap(has_bits1[i], has_bits2[i]); + std::swap(has_bits1[i], has_bits2[i]); } for (int i = 0; i < descriptor_->field_count(); i++) { @@ -360,8 +360,8 @@ void GeneratedMessageReflection::Swap( switch (field->cpp_type()) { #define SWAP_VALUES(CPPTYPE, TYPE) \ case FieldDescriptor::CPPTYPE_##CPPTYPE: \ - swap(*MutableRaw(message1, field), \ - *MutableRaw(message2, field)); \ + std::swap(*MutableRaw(message1, field), \ + *MutableRaw(message2, field)); \ break; SWAP_VALUES(INT32 , int32 ); @@ -376,8 +376,8 @@ void GeneratedMessageReflection::Swap( #undef SWAP_VALUES case FieldDescriptor::CPPTYPE_STRING: - swap(*MutableRaw(message1, field), - *MutableRaw(message2, field)); + std::swap(*MutableRaw(message1, field), + *MutableRaw(message2, field)); break; default: diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 43c9f3f05..1696e2a30 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -491,7 +491,7 @@ void RepeatedField::Swap(RepeatedField* other) { template void RepeatedField::SwapElements(int index1, int index2) { - swap(elements_[index1], elements_[index2]); + std::swap(elements_[index1], elements_[index2]); } template @@ -627,7 +627,7 @@ RepeatedPtrFieldBase::data() const { } inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { - swap(elements_[index1], elements_[index2]); + std::swap(elements_[index1], elements_[index2]); } template