Remove protos/requires.h

PiperOrigin-RevId: 650374125
pull/17327/head
Hong Shin 8 months ago committed by Copybara-Service
parent e1638dc823
commit fba399ad35
  1. 2
      hpb_generator/tests/BUILD
  2. 2
      hpb_generator/tests/test_generated.cc
  3. 5
      protos/BUILD
  4. 17
      protos/requires.h

@ -154,8 +154,8 @@
# "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main",
# "@com_google_absl//absl/status:statusor",
# "@com_google_absl//absl/strings",
# "//hpb:requires",
# "//protos",
# "//protos:requires",
# "//upb:mem",
# "//protos:repeated_field",
# ],

@ -21,10 +21,10 @@
#include "google/protobuf/compiler/hpb/tests/child_model.upb.proto.h"
#include "google/protobuf/compiler/hpb/tests/no_package.upb.proto.h"
#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h"
#include "google/protobuf/hpb/requires.h"
#include "protos/protos.h"
#include "protos/repeated_field.h"
#include "protos/repeated_field_iterator.h"
#include "protos/requires.h"
#include "upb/mem/arena.h"
#include "upb/mem/arena.hpp"

@ -96,9 +96,4 @@
# visibility = ["//visibility:public"],
# )
#
# cc_library(
# name = "requires",
# hdrs = ["requires.h"],
# visibility = ["//visibility:public"],
# )
# end:google_only

@ -1,17 +0,0 @@
#ifndef THIRD_PARTY_UPB_PROTOS_REQUIRES_H_
#define THIRD_PARTY_UPB_PROTOS_REQUIRES_H_
#include <type_traits>
namespace protos::internal {
// Ports C++20 `requires` to C++17.
// C++20 ideal:
// if constexpr (requires { t.foo(); }) { ... }
// Our C++17 stopgap solution:
// if constexpr (Requires<T>([](auto x) -> decltype(x.foo()) {})) { ... }
template <typename... T, typename F>
constexpr bool Requires(F) {
return std::is_invocable_v<F, T...>;
}
} // namespace protos::internal
#endif // THIRD_PARTY_UPB_PROTOS_REQUIRES_H_
Loading…
Cancel
Save