mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 11:43:29 +01:00
Merge pull request #1445 from thecppzoo/master
operator<< works from the global namespace
This commit is contained in:
commit
99b37a4c62
@ -23,7 +23,7 @@ std::ostream& operator << ( std::ostream& os, T const& value ) {
|
|||||||
|
|
||||||
(where ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable - it doesn't have to be in another function).
|
(where ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable - it doesn't have to be in another function).
|
||||||
|
|
||||||
You should put this function in the same namespace as your type and have it declared before including Catch's header.
|
You should put this function in the same namespace as your type, or the global namespace, and have it declared before including Catch's header.
|
||||||
|
|
||||||
## Catch::StringMaker specialisation
|
## Catch::StringMaker specialisation
|
||||||
If you don't want to provide an ```operator <<``` overload, or you want to convert your type differently for testing purposes, you can provide a specialization for `Catch::StringMaker<T>`:
|
If you don't want to provide an ```operator <<``` overload, or you want to convert your type differently for testing purposes, you can provide a specialization for `Catch::StringMaker<T>`:
|
||||||
|
Loading…
Reference in New Issue
Block a user