Make sure to quality calls to std::swap. Otherwise, if a google::swap() exists (e.g. because the user is using our own dense_hash_map implementation) it will be chosen instead, leading to a compile error.
This commit is contained in:
parent
b26684a900
commit
7fb9ae9df3
@ -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());
|
||||
|
@ -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<TYPE>(message1, field), \
|
||||
*MutableRaw<TYPE>(message2, field)); \
|
||||
std::swap(*MutableRaw<TYPE>(message1, field), \
|
||||
*MutableRaw<TYPE>(message2, field)); \
|
||||
break;
|
||||
|
||||
SWAP_VALUES(INT32 , int32 );
|
||||
@ -376,8 +376,8 @@ void GeneratedMessageReflection::Swap(
|
||||
#undef SWAP_VALUES
|
||||
|
||||
case FieldDescriptor::CPPTYPE_STRING:
|
||||
swap(*MutableRaw<string*>(message1, field),
|
||||
*MutableRaw<string*>(message2, field));
|
||||
std::swap(*MutableRaw<string*>(message1, field),
|
||||
*MutableRaw<string*>(message2, field));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -491,7 +491,7 @@ void RepeatedField<Element>::Swap(RepeatedField* other) {
|
||||
|
||||
template <typename Element>
|
||||
void RepeatedField<Element>::SwapElements(int index1, int index2) {
|
||||
swap(elements_[index1], elements_[index2]);
|
||||
std::swap(elements_[index1], elements_[index2]);
|
||||
}
|
||||
|
||||
template <typename Element>
|
||||
@ -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 <typename TypeHandler>
|
||||
|
Loading…
Reference in New Issue
Block a user