diff --git a/BUILD b/BUILD index 1128f715c79..46db2e490ac 100644 --- a/BUILD +++ b/BUILD @@ -521,7 +521,6 @@ grpc_cc_library( "src/core/lib/gprpp/map.h", "src/core/lib/gprpp/memory.h", "src/core/lib/gprpp/mpscq.h", - "src/core/lib/gprpp/pair.h", "src/core/lib/gprpp/string_view.h", "src/core/lib/gprpp/sync.h", "src/core/lib/gprpp/thd.h", diff --git a/BUILD.gn b/BUILD.gn index 0e3e5c51c7b..88bf0e632e2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -149,7 +149,6 @@ config("grpc_config") { "src/core/lib/gprpp/memory.h", "src/core/lib/gprpp/mpscq.cc", "src/core/lib/gprpp/mpscq.h", - "src/core/lib/gprpp/pair.h", "src/core/lib/gprpp/sync.h", "src/core/lib/gprpp/thd.h", "src/core/lib/gprpp/thd_posix.cc", @@ -1252,7 +1251,6 @@ config("grpc_config") { "src/core/lib/gprpp/mpscq.h", "src/core/lib/gprpp/optional.h", "src/core/lib/gprpp/orphanable.h", - "src/core/lib/gprpp/pair.h", "src/core/lib/gprpp/ref_counted.h", "src/core/lib/gprpp/ref_counted_ptr.h", "src/core/lib/gprpp/string_view.h", diff --git a/build.yaml b/build.yaml index 285a33a0140..ed11a9ac3ec 100644 --- a/build.yaml +++ b/build.yaml @@ -291,7 +291,6 @@ filegroups: - src/core/lib/gprpp/map.h - src/core/lib/gprpp/memory.h - src/core/lib/gprpp/mpscq.h - - src/core/lib/gprpp/pair.h - src/core/lib/gprpp/sync.h - src/core/lib/gprpp/thd.h - src/core/lib/profiling/timers.h diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index bc844cd4517..9aa8d215cc0 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -311,7 +311,6 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/pair.h', 'src/core/lib/gprpp/sync.h', 'src/core/lib/gprpp/thd.h', 'src/core/lib/profiling/timers.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 8be7a3d7e5d..e144acb6331 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -214,7 +214,6 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/pair.h', 'src/core/lib/gprpp/sync.h', 'src/core/lib/gprpp/thd.h', 'src/core/lib/profiling/timers.h', @@ -989,7 +988,6 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/pair.h', 'src/core/lib/gprpp/sync.h', 'src/core/lib/gprpp/thd.h', 'src/core/lib/profiling/timers.h', diff --git a/grpc.gemspec b/grpc.gemspec index 698d9f162b5..ef79e0cedea 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -108,7 +108,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gprpp/map.h ) s.files += %w( src/core/lib/gprpp/memory.h ) s.files += %w( src/core/lib/gprpp/mpscq.h ) - s.files += %w( src/core/lib/gprpp/pair.h ) s.files += %w( src/core/lib/gprpp/sync.h ) s.files += %w( src/core/lib/gprpp/thd.h ) s.files += %w( src/core/lib/profiling/timers.h ) diff --git a/package.xml b/package.xml index 56807a958c7..b9ad2970e50 100644 --- a/package.xml +++ b/package.xml @@ -113,7 +113,6 @@ - diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index e0fa6c31dcd..2d5637e1229 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -407,7 +407,7 @@ class XdsLb : public LoadBalancingPolicy { // proportional to the locality's weight. The start of the range is the // previous value in the vector and is 0 for the first element. using PickerList = - InlinedVector>, 1>; + InlinedVector>, 1>; Picker(RefCountedPtr xds_policy, PickerList pickers) : xds_policy_(std::move(xds_policy)), pickers_(std::move(pickers)), @@ -2343,7 +2343,7 @@ void XdsLb::PriorityList::LocalityMap::UpdateXdsPickerLocked() { if (!locality_map_update()->Contains(locality_name)) continue; if (locality->connectivity_state() != GRPC_CHANNEL_READY) continue; end += locality->weight(); - picker_list.push_back(MakePair(end, locality->picker_wrapper())); + picker_list.push_back(std::make_pair(end, locality->picker_wrapper())); } xds_policy()->channel_control_helper()->UpdateState( GRPC_CHANNEL_READY, diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc index 9c6e4c553c7..ec006b16bfd 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc @@ -345,10 +345,11 @@ grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name) { namespace { -void LocalityStatsPopulate(envoy_api_v2_endpoint_UpstreamLocalityStats* output, - Pair, - XdsClientStats::LocalityStats::Snapshot>& input, - upb_arena* arena) { +void LocalityStatsPopulate( + envoy_api_v2_endpoint_UpstreamLocalityStats* output, + std::pair, + XdsClientStats::LocalityStats::Snapshot>& input, + upb_arena* arena) { // Set sub_zone. envoy_api_v2_core_Locality* locality = envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_locality(output, diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index c1b33183d9f..be2d5558571 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -367,7 +367,7 @@ class Subchannel::ConnectedSubchannelStateWatcher void Subchannel::ConnectivityStateWatcherList::AddWatcherLocked( OrphanablePtr watcher) { - watchers_.insert(MakePair(watcher.get(), std::move(watcher))); + watchers_.insert(std::make_pair(watcher.get(), std::move(watcher))); } void Subchannel::ConnectivityStateWatcherList::RemoveWatcherLocked( diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc index 24746e70d0b..d8a0aa4d068 100644 --- a/src/core/lib/channel/channelz.cc +++ b/src/core/lib/channel/channelz.cc @@ -293,7 +293,7 @@ void ChannelNode::SetConnectivityState(grpc_connectivity_state state) { void ChannelNode::AddChildChannel(intptr_t child_uuid) { MutexLock lock(&child_mu_); - child_channels_.insert(MakePair(child_uuid, true)); + child_channels_.insert(std::make_pair(child_uuid, true)); } void ChannelNode::RemoveChildChannel(intptr_t child_uuid) { @@ -303,7 +303,7 @@ void ChannelNode::RemoveChildChannel(intptr_t child_uuid) { void ChannelNode::AddChildSubchannel(intptr_t child_uuid) { MutexLock lock(&child_mu_); - child_subchannels_.insert(MakePair(child_uuid, true)); + child_subchannels_.insert(std::make_pair(child_uuid, true)); } void ChannelNode::RemoveChildSubchannel(intptr_t child_uuid) { @@ -323,7 +323,7 @@ ServerNode::~ServerNode() {} void ServerNode::AddChildSocket(RefCountedPtr node) { MutexLock lock(&child_mu_); - child_sockets_.insert(MakePair(node->uuid(), std::move(node))); + child_sockets_.insert(std::make_pair(node->uuid(), std::move(node))); } void ServerNode::RemoveChildSocket(intptr_t child_uuid) { @@ -333,7 +333,7 @@ void ServerNode::RemoveChildSocket(intptr_t child_uuid) { void ServerNode::AddChildListenSocket(RefCountedPtr node) { MutexLock lock(&child_mu_); - child_listen_sockets_.insert(MakePair(node->uuid(), std::move(node))); + child_listen_sockets_.insert(std::make_pair(node->uuid(), std::move(node))); } void ServerNode::RemoveChildListenSocket(intptr_t child_uuid) { diff --git a/src/core/lib/gprpp/arena.cc b/src/core/lib/gprpp/arena.cc index 5c344db4e35..61688258a1c 100644 --- a/src/core/lib/gprpp/arena.cc +++ b/src/core/lib/gprpp/arena.cc @@ -64,14 +64,14 @@ Arena* Arena::Create(size_t initial_size) { return new (ArenaStorage(initial_size)) Arena(initial_size); } -Pair Arena::CreateWithAlloc(size_t initial_size, - size_t alloc_size) { +std::pair Arena::CreateWithAlloc(size_t initial_size, + size_t alloc_size) { static constexpr size_t base_size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Arena)); auto* new_arena = new (ArenaStorage(initial_size)) Arena(initial_size, alloc_size); void* first_alloc = reinterpret_cast(new_arena) + base_size; - return MakePair(new_arena, first_alloc); + return std::make_pair(new_arena, first_alloc); } size_t Arena::Destroy() { diff --git a/src/core/lib/gprpp/arena.h b/src/core/lib/gprpp/arena.h index b1b0c4a85cb..67c91d9f490 100644 --- a/src/core/lib/gprpp/arena.h +++ b/src/core/lib/gprpp/arena.h @@ -36,7 +36,6 @@ #include "src/core/lib/gpr/alloc.h" #include "src/core/lib/gpr/spinlock.h" #include "src/core/lib/gprpp/atomic.h" -#include "src/core/lib/gprpp/pair.h" #include @@ -50,8 +49,8 @@ class Arena { // Create an arena, with \a initial_size bytes in the first allocated buffer, // and return both a void pointer to the returned arena and a void* with the // first allocation. - static Pair CreateWithAlloc(size_t initial_size, - size_t alloc_size); + static std::pair CreateWithAlloc(size_t initial_size, + size_t alloc_size); // Destroy an arena, returning the total number of bytes allocated. size_t Destroy(); diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h index 0d61f902757..7e954cc2be8 100644 --- a/src/core/lib/gprpp/map.h +++ b/src/core/lib/gprpp/map.h @@ -30,7 +30,6 @@ #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/memory.h" -#include "src/core/lib/gprpp/pair.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/string_view.h" diff --git a/src/core/lib/gprpp/pair.h b/src/core/lib/gprpp/pair.h deleted file mode 100644 index ca8294cc7bb..00000000000 --- a/src/core/lib/gprpp/pair.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_LIB_GPRPP_PAIR_H -#define GRPC_CORE_LIB_GPRPP_PAIR_H - -#include - -#include - -namespace grpc_core { -template -using Pair = std::pair; - -template -inline Pair::type, typename std::decay::type> -MakePair(T1&& u, T2&& v) { - typedef typename std::decay::type V1; - typedef typename std::decay::type V2; - return Pair(std::forward(u), std::forward(v)); -} -} // namespace grpc_core -#endif /* GRPC_CORE_LIB_GPRPP_PAIR_H */ diff --git a/src/core/lib/transport/connectivity_state.cc b/src/core/lib/transport/connectivity_state.cc index 32aa99306be..3edb5148d1d 100644 --- a/src/core/lib/transport/connectivity_state.cc +++ b/src/core/lib/transport/connectivity_state.cc @@ -123,7 +123,7 @@ void ConnectivityStateTracker::AddWatcher( // If we're in state SHUTDOWN, don't add the watcher, so that it will // be orphaned immediately. if (current_state != GRPC_CHANNEL_SHUTDOWN) { - watchers_.insert(MakePair(watcher.get(), std::move(watcher))); + watchers_.insert(std::make_pair(watcher.get(), std::move(watcher))); } } diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index fd709c70e84..ada328dd92f 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1117,7 +1117,6 @@ src/core/lib/gprpp/memory.h \ src/core/lib/gprpp/mpscq.h \ src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ -src/core/lib/gprpp/pair.h \ src/core/lib/gprpp/ref_counted.h \ src/core/lib/gprpp/ref_counted_ptr.h \ src/core/lib/gprpp/string_view.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index eba49015f19..bc199120f00 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1253,7 +1253,6 @@ src/core/lib/gprpp/mpscq.cc \ src/core/lib/gprpp/mpscq.h \ src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ -src/core/lib/gprpp/pair.h \ src/core/lib/gprpp/ref_counted.h \ src/core/lib/gprpp/ref_counted_ptr.h \ src/core/lib/gprpp/string_view.h \