Enable OwningRewritePatternList insert overload with parameter pack only when

there is at least one template pattern type

Also remove the other insert overload with pattern pointer as there are no existing users nor any potential known use-case.

PiperOrigin-RevId: 266842920
This commit is contained in:
Smit Hinsu 2019-09-02 19:59:08 -07:00 committed by A. Unique TensorFlower
parent 5c036e682d
commit c05890e890
1 changed files with 3 additions and 4 deletions

View File

@ -408,13 +408,12 @@ public:
// Pattern Insertion // Pattern Insertion
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
void insert(RewritePattern *pattern) { patterns.emplace_back(pattern); }
/// Add an instance of each of the pattern types 'Ts' to the pattern list with /// Add an instance of each of the pattern types 'Ts' to the pattern list with
/// the given arguments. /// the given arguments.
// Note: ConstructorArg is necessary here to separate the two variadic lists. /// Note: ConstructorArg is necessary here to separate the two variadic lists.
template <typename... Ts, typename ConstructorArg, template <typename... Ts, typename ConstructorArg,
typename... ConstructorArgs> typename... ConstructorArgs,
typename = std::enable_if_t<sizeof...(Ts) != 0>>
void insert(ConstructorArg &&arg, ConstructorArgs &&... args) { void insert(ConstructorArg &&arg, ConstructorArgs &&... args) {
// The following expands a call to emplace_back for each of the pattern // The following expands a call to emplace_back for each of the pattern
// types 'Ts'. This magic is necessary due to a limitation in the places // types 'Ts'. This magic is necessary due to a limitation in the places