Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add Catch::is_range to documentation

Commit
5e484862f2198b3501457f054f52228960d4d9a3
Author
Martin Hořeňovský ·
Parents
5713381d060e

Files · Download .tar.gz

Changes

 docs/tostring.md | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/docs/tostring.md b/docs/tostring.md
index cfca0533..568c1c27 100644
--- a/docs/tostring.md
+++ b/docs/tostring.md
@@ -33,6 +33,23 @@ namespace Catch {
 }
 ```
 
+## Catch::is_range<T> specialisation
+As a fallback, Catch attempts to detect if the type can be iterated
+(`begin(T)` and `end(T)` are valid) and if it can be, it is stringified
+as a range. For certain types this can lead to infinite recursion, so
+it can be disabled by specializing `Catch::is_range` like so:
+
+```cpp
+namespace Catch {
+    template<>
+    struct is_range<T> {
+        static const bool value = false;
+    };
+}
+
+```
+
+
 ## Exceptions
 
 By default all exceptions deriving from `std::exception` will be translated to strings by calling the `what()` method. For exception types that do not derive from `std::exception` - or if `what()` does not return a suitable string - use `CATCH_TRANSLATE_EXCEPTION`. This defines a function that takes your exception type, by reference, and returns a string. It can appear anywhere in the code - it doesn't have to be in the same translation unit. For example: