Skip to content

Instantly share code, notes, and snippets.

@JayBazuzi
Created April 30, 2017 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayBazuzi/b2f1b6562018b088ac849275e7f24d8f to your computer and use it in GitHub Desktop.
Save JayBazuzi/b2f1b6562018b088ac849275e7f24d8f to your computer and use it in GitHub Desktop.
namespace CPPUNIT_NS
{
template <template <typename...> class C, typename... T> struct assertion_traits<C<T...>>
{
inline static bool equal(C<T...> const& left, C<T...> const& right)
{
return std::equal(
left.cbegin(), left.cend(), right.cbegin(), assertion_traits<decltype(*(left.cbegin()))>::equal);
}
inline static std::string toString(C<T...> const& x)
{
ostringstream os;
os << "[";
std::transform(
x.cbegin(), x.cend(), ostream_iterator<string>(os, ","),
assertion_traits<decltype(*(x.cbegin()))>::toString);
os << "]";
return os.str();
}
assertion_traits<C<T...>>() = delete;
~assertion_traits<C<T...>>() = delete;
assertion_traits<C<T...>>(const assertion_traits<C<T...>>&) = delete;
assertion_traits<C<T...>>& operator=(const assertion_traits<C<T...>>&) = delete;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment