| 520 | } |
| 521 | |
| 522 | std::shared_ptr<MatchConstraint> AllTypesAreIdenticalFrom(size_t first_type_index) { |
| 523 | return MatchConstraint::Make( |
| 524 | [first_type_index](const std::vector<TypeHolder>& types) -> bool { |
| 525 | DCHECK_LT(first_type_index, types.size()); |
| 526 | return std::all_of(types.begin() + first_type_index + 1, types.end(), |
| 527 | [&types, first_type_index](const TypeHolder& type) { |
| 528 | return type == types[first_type_index]; |
| 529 | }); |
| 530 | }); |
| 531 | } |
| 532 | |
| 533 | std::shared_ptr<MatchConstraint> AllTypesAreIdentical() { |
| 534 | static auto instance = AllTypesAreIdenticalFrom(/*first_type_index=*/0); |