================ @@ -858,6 +859,30 @@ class PackDeductionScope { Info.PendingDeducedPacks[Pack.Index] = Pack.Outer; } + std::optional<unsigned> getSavedPackSize(unsigned Index, + TemplateArgument Pattern) const { + + SmallVector<UnexpandedParameterPack, 2> Unexpanded; + S.collectUnexpandedParameterPacks(Pattern, Unexpanded); + if (Unexpanded.size() == 0 || + Packs[0].Saved.getKind() != clang::TemplateArgument::Pack) + return {}; + unsigned PackSize = Packs[0].Saved.pack_size(); + + if (std::all_of(Packs.begin() + 1, Packs.end(), [&PackSize](auto P) { + return P.Saved.getKind() == TemplateArgument::Pack && + P.Saved.pack_size() == PackSize; + })) + return PackSize; + return {}; + } + + /// Determine whether this pack has already been deduced from a previous + /// argument. + bool isDeducedFromEarlierParameter() const { + return DeducedFromEarlierParameter; + } + ---------------- spaits wrote:
This code at the this state(the state in which you wrote this comment) is more complicated then it should be. I was able to make it more simple. I gave a new name to this function, that describes better what this function does. We are using the `Saved` packs here that are only modified in the constructors. The `Saved` packs are the previously deduced packs. https://github.com/llvm/llvm-project/pull/79371 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits