When trying to use Catch in an embedded environment I noticed that std::wstring isn't availble. This patch wraps the wstring variants of toString in #ifdef on wchar_t. There most likely is a cleaner way to check this but I just couldn't figure it out :)
Only add wstring versions of toString if wchar_t has been defined. Th…
…is fixes some issues on embedded platforms where wstring isn't available.
This will break for anyone who's using a standards-compliant C++ compilers, where wchar_t is a built-in type rather than a preprocessor definition.
You probably want to have some #ifdef's based around your compiler's version macros or somesuch.
Hmmm, you're right. I thought I tried this with avr32-gcc (the culprit), gcc-4.4.7 on Ubuntu and Clang-4.1 on OSX but I will need to tripple check that. I'll try to come up with a better solution and repost the pull request.
I wonder if it's possible to detect in a portable way. Boost seems to have an option to disable certain functionality if wchar_t isn't available, for example BOOST_NO_STD_WSTRING (see Lexical Cast source).
Would you (Phil) be interested in such a solution or do you prefer to keep it clean?
IIRC, Boost does quite a bit of heroics to figure out if it needs to define BOOST_NO_STD_WSTRING - and I wouldn't recommend reimplementing that wheel.
I'd be inclined to use something like CATCH_CONFIG_NO_WSTRING and let users who don't have (or don't want) wstring support define it or not as they see fit.
Revert "Only add wstring versions of toString if wchar_t has been def…
…ined. This fixes some issues on embedded platforms where wstring isn't available."
This will be done with a simple #ifdef instead.
This reverts commit 6498a51.
Add the possibility to define CATCH_CONFIG_NO_WSTRING to disable wstr…
…ing support on platforms where it's not supported (AVR32, for example).
Sorry for the delay. The first attempt has been reverted and replaced with an ifdef. Catch now builds on my AVR32 target.