tvm
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tvm::PMatchesOneOf< TPattern > Class Template Reference

#include <pattern_match.h>

Collaboration diagram for tvm::PMatchesOneOf< TPattern >:

Public Member Functions

 PMatchesOneOf (const TPattern &... patterns)
 
template<typename NodeType >
bool Match (const NodeType &value) const
 Check if value matches one of the patterns.
 
template<typename NodeType , typename Condition >
bool Match (const NodeType &value, Condition cond) const
 Check if value matches one of the patterns.
 

Constructor & Destructor Documentation

◆ PMatchesOneOf()

template<typename... TPattern>
tvm::PMatchesOneOf< TPattern >::PMatchesOneOf ( const TPattern &...  patterns)
inlineexplicit

Member Function Documentation

◆ Match() [1/2]

template<typename... TPattern>
template<typename NodeType >
bool tvm::PMatchesOneOf< TPattern >::Match ( const NodeType &  value) const
inline

Check if value matches one of the patterns.

This call also populates the PVars with matched value based on the first successful match. The values in PVars are valid until the next call to Match.

Parameters
valueThe value to be matched against.
Returns
Whether value matches the pattern.

◆ Match() [2/2]

template<typename... TPattern>
template<typename NodeType , typename Condition >
bool tvm::PMatchesOneOf< TPattern >::Match ( const NodeType &  value,
Condition  cond 
) const
inline

Check if value matches one of the patterns.

This call also populates the PVars with matched value based on the first successful match. The values in PVars are valid until the next call to Match.

Parameters
valueThe value to be matched against.
condA callable that performs additional validation, returning true if the match passes. This will typically be a lambda function written in terms of the filled PVars. This will be called once for each successful pattern match. If cond() returns false, the next match will be attempted.
Returns
Whether value matches the pattern.

The documentation for this class was generated from the following file: