Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/docs/generators.md
diff options
context:
space:
mode:
authorMartin Hořeňovský2026-02-09 19:05:39 +0100
committerMartin Hořeňovský2026-02-10 09:37:15 +0100
commitd079ee13ab137547ab26bd1ed5ca2858d7fbd847 (patch)
tree1e73da54d02eecbf095dd07bd4c0183d7a7f107b /docs/generators.md
parent0056cd4efb01ab65f02af188e137fc65d79e18f8 (diff)
downloadcatch3-d079ee13ab137547ab26bd1ed5ca2858d7fbd847.tar.gz
Allow generators to declare themselves (infinite)
This will be useful later to implement warning on infinitely running `GENERATE` expressions.
Diffstat (limited to 'docs/generators.md')
-rw-r--r--docs/generators.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/generators.md b/docs/generators.md
index f45eac06..5db2941b 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -276,11 +276,22 @@ struct IGenerator : GeneratorUntypedBase {
* Going backwards is not supported.
*/
virtual void skipToNthElementImpl( std::size_t n );
+
+ /**
+ * Returns true if calls to `next` will eventually return false
+ *
+ * Note that for backwards compatibility this is currently defaulted
+ * to return `true`, but in the future all generators will have to
+ * provide their own implementation.
+ */
+ virtual bool isFinite() const = 0;
};
```
> `skipToNthElementImpl` was added in Catch2 vX.Y.Z
+> `isFinite` was added in Catch2 vX.Y.Z
+
However, to be able to use your custom generator inside `GENERATE`, it
will need to be wrapped inside a `GeneratorWrapper<T>`.
`GeneratorWrapper<T>` is a value wrapper around a