Merge f1e068d5c577a019f1f6c199f2e3f21859c45d13 into 1b96fa13f549387b7549cc89e1a785cf143a1a50

This commit is contained in:
Jeremy Nimmer 2025-11-12 14:15:49 -05:00 committed by GitHub
commit 2a199ebda5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,6 +99,7 @@ class ParamGenerator;
template <typename T> template <typename T>
class ParamIteratorInterface { class ParamIteratorInterface {
public: public:
ParamIteratorInterface() = default;
virtual ~ParamIteratorInterface() = default; virtual ~ParamIteratorInterface() = default;
// A pointer to the base generator instance. // A pointer to the base generator instance.
// Used only for the purposes of iterator comparison // Used only for the purposes of iterator comparison
@ -121,6 +122,9 @@ class ParamIteratorInterface {
// element in the sequence generated by the generator. // element in the sequence generated by the generator.
// Used for implementing ParamGenerator<T>::operator==(). // Used for implementing ParamGenerator<T>::operator==().
virtual bool Equals(const ParamIteratorInterface& other) const = 0; virtual bool Equals(const ParamIteratorInterface& other) const = 0;
protected:
// Make available for subclasses to use to implement Clone().
ParamIteratorInterface(const ParamIteratorInterface&) = default;
}; };
// Class iterating over elements provided by an implementation of // Class iterating over elements provided by an implementation of
@ -842,7 +846,7 @@ class CartesianProductGenerator
template <class I> template <class I>
class IteratorImpl; class IteratorImpl;
template <size_t... I> template <size_t... I>
class IteratorImpl<std::index_sequence<I...>> class IteratorImpl<std::index_sequence<I...>> final
: public ParamIteratorInterface<ParamType> { : public ParamIteratorInterface<ParamType> {
public: public:
IteratorImpl(const ParamGeneratorInterface<ParamType>* base, IteratorImpl(const ParamGeneratorInterface<ParamType>* base,
@ -854,7 +858,7 @@ class CartesianProductGenerator
current_(is_end ? end_ : begin_) { current_(is_end ? end_ : begin_) {
ComputeCurrentValue(); ComputeCurrentValue();
} }
~IteratorImpl() override = default; ~IteratorImpl() final = default;
const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
return base_; return base_;
@ -898,6 +902,8 @@ class CartesianProductGenerator
} }
private: private:
IteratorImpl(const IteratorImpl&) = default;
template <size_t ThisI> template <size_t ThisI>
void AdvanceIfEnd() { void AdvanceIfEnd() {
if (std::get<ThisI>(current_) != std::get<ThisI>(end_)) return; if (std::get<ThisI>(current_) != std::get<ThisI>(end_)) return;