mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Implement toString( std::pair<T1,T2> )
- Transplanted the earlier implementation of StringMaker<pair>from ToStringPair.cpp to catch_tostring.h - Remove the specialisation of toString( pair<int,int> ) from TrickyTests.cpp
This commit is contained in:
@@ -237,6 +237,20 @@ struct StringMaker<std::tuple<Types...>> {
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct StringMaker<std::pair<T1,T2> > {
|
||||
static std::string convert( const std::pair<T1,T2>& pair ) {
|
||||
std::ostringstream oss;
|
||||
oss << "{ "
|
||||
<< Catch::toString( pair.first )
|
||||
<< ", "
|
||||
<< Catch::toString( pair.second )
|
||||
<< " }";
|
||||
return oss.str();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace Detail {
|
||||
template<typename T>
|
||||
std::string makeString( T const& value ) {
|
||||
@@ -244,6 +258,7 @@ namespace Detail {
|
||||
}
|
||||
} // end namespace Detail
|
||||
|
||||
|
||||
/// \brief converts any type to a string
|
||||
///
|
||||
/// The default template forwards on to ostringstream - except when an
|
||||
|
Reference in New Issue
Block a user