source: tests/zombies/gc_no_raii/src/tools.h @ aa144c5a

ADTast-experimentalpthread-emulation
Last change on this file since aa144c5a was fd54fef, checked in by Michael Brooks <mlbrooks@…>, 4 years ago

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

  • Property mode set to 100644
File size: 755 bytes
RevLine 
[15db1ab]1#pragma once
2
[e47f529]3#include "tools/checks.h"
4#include "tools/print.h"
[df4aea7]5
6// forall(otype T)
7// inline void swap(T* const a, T* const b)
8// {
9//      T* temp = a;
10//      *a = *b;
11//      *b = *temp;
12// }
13
[fd54fef]14trait has_equal(T)
[df4aea7]15{
16        signed int ?==?(T a, T b);
17};
18
[fd54fef]19trait InputIterator_t(T, InputIterator)
[df4aea7]20{
21        signed int ?==?(InputIterator a, InputIterator b);
22        signed int ?!=?(InputIterator a, InputIterator b);
23        T *?(InputIterator a);
24        InputIterator ++?(InputIterator* a);
25        InputIterator ?++(InputIterator* a);
26};
27
[fd54fef]28forall(T | has_equal(T), InputIterator | InputIterator_t(T, InputIterator))
[16cfd8c]29static inline InputIterator find( InputIterator first, const InputIterator* const last, T val)
[df4aea7]30{
31        while ( first != *last)
32        {
33                if(*first == val) return first;
34                ++first;
35        }
36        return *last;
37}
Note: See TracBrowser for help on using the repository browser.