Skip to content

Commit

Permalink
Re-use is_patch_v in AnyPatch
Browse files Browse the repository at this point in the history
Summary: TSIA

Reviewed By: praihan

Differential Revision: D68005446

fbshipit-source-id: 401ab47f93a4492ba58d8322ff958c6c31fd987a
  • Loading branch information
thedavekwon authored and facebook-github-bot committed Jan 13, 2025
1 parent 2d42a20 commit 4c7099f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions thrift/lib/thrift/detail/AnyPatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,7 @@ class AnyPatch : public BaseClearPatch<Patch, AnyPatch<Patch>> {
/// patch.
template <typename VPatch>
void patchIfTypeIs(const VPatch& patch) {
// TODO(dokwon): Refactor PatchTrait to use is_patch_v.
static_assert(std::is_base_of_v<
BasePatch<typename VPatch::underlying_type, VPatch>,
VPatch>);
static_assert(op::is_patch_v<VPatch>);
tryPatchable<VPatch>();
patchIfTypeIsImpl(
patch, ensures<type::infer_tag<typename VPatch::value_type>>());
Expand All @@ -210,10 +207,7 @@ class AnyPatch : public BaseClearPatch<Patch, AnyPatch<Patch>> {
/// in Thrift Any if the type matches with the provided patch.
template <typename VPatch>
void ensureAndPatch(const VPatch& patch) {
// TODO(dokwon): Refactor PatchTrait to use is_patch_v.
static_assert(std::is_base_of_v<
BasePatch<typename VPatch::underlying_type, VPatch>,
VPatch>);
static_assert(op::is_patch_v<VPatch>);
using VTag = type::infer_tag<typename VPatch::value_type>;
ensureAny(type::AnyData::toAny<VTag>({}).toThrift());
patchIfTypeIsImpl(patch, true);
Expand Down

0 comments on commit 4c7099f

Please sign in to comment.