mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 09:19:36 +01:00
* An forward non-random access input iterator class for ATermLists.
This commit is contained in:
parent
3e5a019a07
commit
45610ae675
6 changed files with 68 additions and 88 deletions
|
|
@ -14,6 +14,28 @@ string atPrint(ATerm t);
|
|||
/* Write an ATerm to an output stream. */
|
||||
ostream & operator << (ostream & stream, ATerm e);
|
||||
|
||||
class ATermIterator
|
||||
{
|
||||
ATermList t;
|
||||
|
||||
public:
|
||||
ATermIterator(ATermList _t) : t(_t) { }
|
||||
ATermIterator & operator ++ ()
|
||||
{
|
||||
t = ATgetNext(t);
|
||||
return *this;
|
||||
}
|
||||
ATerm operator * ()
|
||||
{
|
||||
return ATgetFirst(t);
|
||||
}
|
||||
operator bool ()
|
||||
{
|
||||
return t != ATempty;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* Type-safe matching. */
|
||||
|
||||
struct ATMatcher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue