Contains algorithms that look over (and possibly modify on the go) expressions for you, given a certain function to apply to nodes in the tree expression. More...


Go to the source code of this file.
Namespaces | |
| csl | |
| Namespace for csl library. | |
Functions | |
| Expr | csl::FindLeaf (Expr const &init, Expr const &value, size_t depth=-1) |
| Searches and returns an expression in another. More... | |
| Expr | csl::FindNode (Expr const &init, Expr const &node, size_t depth=-1) |
| Searches and returns an expression in another. More... | |
| Expr | csl::FindIfLeaf (Expr const &init, std::function< bool(Expr const &)> const &f, size_t depth=-1) |
| Searches and returns an expression in another. More... | |
| Expr | csl::FindIfNode (Expr const &init, std::function< bool(Expr const &)> const &f, size_t depth=-1) |
| Searches and returns an expression in another. More... | |
| bool | csl::AnyOfLeafs (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1) |
| Tells if any of the leafs of an expression respect a certain condition given by the user. More... | |
| bool | csl::AnyOfLeafs (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1) |
| bool | csl::AllOfLeafs (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1) |
| Tells if all of the leafs of an expression respect a certain condition given by the user. More... | |
| bool | csl::AllOfLeafs (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1) |
| bool | csl::AnyOfNodes (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1) |
| Tells if any of the nodes of an expression respect a certain condition given by the user. More... | |
| bool | csl::AnyOfNodes (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1) |
| bool | csl::AllOfNodes (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1) |
| Tells if all of the nodes of an expression respect a certain condition given by the user. More... | |
| bool | csl::AllOfNodes (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1) |
| void | csl::VisitEachNode (Expr const &init, std::function< void(Expr const &)> const &f, int depth=-1) |
| Visits all nodes of an expression, applying a function on it without modifying it. More... | |
| void | csl::VisitEachNodeReversed (Expr const &init, std::function< void(Expr const &)> const &f, int depth=-1) |
| void | csl::VisitEachNode (Expr_info init, std::function< void(Expr_info)> const &f, int depth=-1) |
| void | csl::VisitEachLeaf (Expr const &init, std::function< void(Expr const &)> const &f, int depth=-1) |
| Visits all leafs of an expression, applying a function on it without modifying it. More... | |
| void | csl::VisitEachLeaf (Expr_info init, std::function< void(Expr_info)> const &f, int depth=-1) |
| void | csl::VisitEachNodeCut (Expr const &init, std::function< bool(Expr const &)> const &f, int depth=-1) |
| Visits all nodes of an expression, applying a function on it without modifying it. When the user function returns true on one node, the underlying branch (if there is) is not explored. More... | |
| void | csl::VisitEachNodeCut (Expr_info init, std::function< bool(Expr_info)> const &f, int depth=-1) |
| bool | csl::isUnique (csl::Expr const &expr) |
| size_t | csl::Count (csl::Expr const &expr, csl::Expr const &search) |
| size_t | csl::CountIf (csl::Expr const &expr, std::function< bool(csl::Expr const &)> const &f) |
| size_t | csl::CountNodes (Expr const &init) |
| size_t | csl::CountLeafs (Expr const &init) |
| void | csl::ForEachNode (Expr &init, std::function< void(Expr &)> const &f, int depth=-1) |
| Applies a user function on each node of an expression. The expression may be modified. More... | |
| void | csl::ForEachNodeReversed (Expr &init, std::function< void(Expr &)> const &f, int depth=-1) |
| void | csl::ForEachLeaf (Expr &init, std::function< void(Expr &)> const &f, int depth=-1) |
| Applies a user function on each leaf of an expression. The expression may be modified. More... | |
| void | csl::ForEachNodeCut (Expr &init, std::function< bool(Expr &)> const &f, int depth=-1) |
| Applies a user function on each node of an expression. The expression may be modified. More... | |
| bool | csl::FirstOfNode (Expr &init, std::function< bool(Expr &)> const &f) |
| Tells if any of the nodes of an expression respect a certain condition given by the user. The condition function may apply on the go on the expression found. More... | |
| bool | csl::FirstOfLeaf (Expr &init, std::function< bool(Expr &)> const &f) |
| Tells if any of the leafs of an expression respect a certain condition given by the user. The condition function may apply on the go on the expression found. More... | |
| bool | csl::VisitFirstOfNode (Expr const &init, std::function< bool(Expr const &)> const &f) |
| bool | csl::VisitFirstOfLeaf (Expr const &init, std::function< bool(Expr const &)> const &f) |
| bool | csl::Transform (Expr &init, std::function< bool(Expr &)> const &f, int depth=-1) |
| Applies a user function on each node of an expression. The expression may be modified. If it is, the expression is refreshed. More... | |
Contains algorithms that look over (and possibly modify on the go) expressions for you, given a certain function to apply to nodes in the tree expression.
All algorithms work the same way. The user provides an initial expression and a function. The expression will be browsed entirely by the algorithm, and the user function will be called on each node or leaf of the expression tree. The function may be equivalently an inline lambda expression, a lambda stored in a variable or a standard function pointer. Here is an example:
In this example, consider the expression
. If you call a node algorithm on it, the function you pass will be called with successively:












whereas with a leaf algorithm, the function will be called on:






1.8.13