Avoid opening namespace std

This commit is contained in:
Chris Thrasher 2022-06-28 12:13:32 -06:00 committed by Lukas Dürrenberger
parent 8561101b11
commit 45986c6400

View File

@ -4,19 +4,26 @@
#include <doctest/doctest.h> #include <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <cassert>
#include <vector> #include <vector>
namespace std // Use StringMaker to avoid opening namespace std
namespace doctest
{ {
std::ostream& operator<<(std::ostream& out, const std::vector<float>& vector) template <>
struct StringMaker<std::vector<float>>
{ {
out << "{ "; static String convert(const std::vector<float>& vector)
for (size_t i = 0; i + 1 < vector.size(); ++i) {
out << vector[i] << ", "; assert(!vector.empty());
out << vector.back() << " }"; doctest::String out = "{ ";
return out; for (size_t i = 0; i + 1 < vector.size(); ++i)
} out += toString(vector[i]) + ", ";
} // namespace std out += toString(vector.back()) + " }";
return out;
}
};
} // namespace doctest
TEST_CASE("sf::Transform class - [graphics]") TEST_CASE("sf::Transform class - [graphics]")
{ {