|
tvm
|
Base class of all the patterns. More...
#include <pattern_match.h>
Public Types | |
| using | Nested = Derived |
| Nested storage type in the expression. | |
Public Member Functions | |
| template<typename NodeType > | |
| bool | Match (const NodeType &value) const |
| Check if value matches the current pattern. | |
| template<typename NodeType , typename Condition > | |
| bool | Match (const NodeType &value, Condition cond) const |
| Check if value matches the current pattern. | |
| const Derived & | derived () const |
Base class of all the patterns.
There are two major member functions supported by each pattern.
We use curiously recurring template pattern to construct expression templates.
| Derived | The type of the derived class. |
| using tvm::Pattern< Derived >::Nested = Derived |
Nested storage type in the expression.
Depending on the Derived class, Nested can be Derived (nest by value) or const Derived& (nest by reference).
The trick of Nested typedef originates from Eigen.
|
inline |
|
inline |
Check if value matches the current pattern.
This call also populates the PVars with matched value. The values in PVars are valid until the next call to Match.
| value | The value to be matched against |
|
inline |
Check if value matches the current pattern.
This call also populates the PVars with matched value. The values in PVars are valid until the next call to Match.
| value | The value to be matched against |
| cond | A 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. |