Template Class PMatchesOneOf

Template Class PMatchesOneOf#

Class Documentation#

template<typename ...TPattern>
class PMatchesOneOf#

Public Functions

inline explicit PMatchesOneOf(const TPattern&... patterns)#
template<typename NodeType>
inline bool Match(const NodeType &value) const#

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:

value – The value to be matched against.

Returns:

Whether value matches the pattern.

template<typename NodeType, typename Condition>
inline bool Match(const NodeType &value, Condition cond) const#

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:
  • 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. 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.