Clang compilation fixes: use non-template stream output operators
This commit is contained in:
parent
f0611657ac
commit
d7469920de
12 changed files with 52 additions and 22 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
#include <psemek/geom/detail/array.hpp>
|
||||
#include <psemek/geom/interval.hpp>
|
||||
#include <psemek/geom/point.hpp>
|
||||
|
|
@ -239,8 +241,8 @@ namespace psemek::geom
|
|||
return *this = *this | b;
|
||||
}
|
||||
|
||||
template <typename Stream, typename T, std::size_t N>
|
||||
Stream & operator << (Stream & os, box<T, N> const & b)
|
||||
template <typename T, std::size_t N>
|
||||
std::ostream & operator << (std::ostream & os, box<T, N> const & b)
|
||||
{
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <cmath>
|
||||
|
|
@ -250,8 +252,8 @@ namespace psemek::geom
|
|||
return i.min + i.length() * t;
|
||||
}
|
||||
|
||||
template <typename Stream, typename T>
|
||||
Stream & operator << (Stream & os, interval<T> const & i)
|
||||
template <typename T>
|
||||
std::ostream & operator << (std::ostream & os, interval<T> const & i)
|
||||
{
|
||||
os << '[' << i.min << " .. " << i.max << ']';
|
||||
return os;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
#include <psemek/geom/detail/array.hpp>
|
||||
#include <psemek/geom/vector.hpp>
|
||||
#include <psemek/geom/math.hpp>
|
||||
|
|
@ -303,8 +305,8 @@ namespace psemek::geom
|
|||
return r;
|
||||
}
|
||||
|
||||
template <typename Stream, typename T, std::size_t R, std::size_t C>
|
||||
Stream & operator << (Stream & os, matrix<T, R, C> const & m)
|
||||
template <typename T, std::size_t R, std::size_t C>
|
||||
std::ostream & operator << (std::ostream & os, matrix<T, R, C> const & m)
|
||||
{
|
||||
for (std::size_t i = 0; i < R; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
#include <psemek/geom/detail/array.hpp>
|
||||
#include <psemek/geom/vector.hpp>
|
||||
|
||||
|
|
@ -188,8 +190,8 @@ namespace psemek::geom
|
|||
return normalized(ort((ps - p0)...));
|
||||
}
|
||||
|
||||
template <typename Stream, typename T, std::size_t N>
|
||||
Stream & operator << (Stream & os, point<T, N> const & p)
|
||||
template <typename T, std::size_t N>
|
||||
std::ostream & operator << (std::ostream & os, point<T, N> const & p)
|
||||
{
|
||||
os << '(' << p[0];
|
||||
for (std::size_t i = 1; i < N; ++i)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/assert.hpp>
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
namespace psemek::geom
|
||||
{
|
||||
|
|
@ -12,8 +13,7 @@ namespace psemek::geom
|
|||
negative = -1,
|
||||
};
|
||||
|
||||
template <typename OStream>
|
||||
OStream & operator << (OStream & o, sign_t s)
|
||||
inline std::ostream & operator << (std::ostream & o, sign_t s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
#include <psemek/geom/point.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
|
@ -34,8 +36,8 @@ namespace psemek::geom
|
|||
template <typename Point>
|
||||
using triangle = simplex<Point, 2>;
|
||||
|
||||
template <typename Stream, typename Point, std::size_t K>
|
||||
Stream & operator << (Stream & os, simplex<Point, K> const & s)
|
||||
template <typename Point, std::size_t K>
|
||||
std::ostream & operator << (std::ostream & os, simplex<Point, K> const & s)
|
||||
{
|
||||
os << '(' << s[0];
|
||||
for (std::size_t i = 1; i <= K; ++i)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
#include <psemek/geom/detail/array.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
|
@ -340,8 +342,8 @@ namespace psemek::geom
|
|||
}
|
||||
}
|
||||
|
||||
template <typename Stream, typename T, std::size_t N>
|
||||
Stream & operator << (Stream & os, vector<T, N> const & v)
|
||||
template <typename T, std::size_t N>
|
||||
std::ostream & operator << (std::ostream & os, vector<T, N> const & v)
|
||||
{
|
||||
if constexpr (N == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace psemek::log
|
||||
{
|
||||
|
||||
|
|
@ -11,8 +13,7 @@ namespace psemek::log
|
|||
error,
|
||||
};
|
||||
|
||||
template <typename Stream>
|
||||
Stream & operator << (Stream & s, level l)
|
||||
inline std::ostream & operator << (std::ostream & s, level l)
|
||||
{
|
||||
switch (l)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace psemek::util
|
||||
{
|
||||
|
||||
struct empty{};
|
||||
|
||||
template <typename Stream>
|
||||
Stream & operator << (Stream & os, empty)
|
||||
std::ostream & operator << (std::ostream & os, empty)
|
||||
{
|
||||
os << "empty";
|
||||
return os;
|
||||
|
|
|
|||
14
libs/util/include/psemek/util/io_fwd.hpp
Normal file
14
libs/util/include/psemek/util/io_fwd.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<typename Char, typename Traits>
|
||||
class basic_istream;
|
||||
|
||||
template<typename Char, typename Traits>
|
||||
class basic_ostream;
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/util/io_fwd.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
|
|
@ -82,8 +84,8 @@ namespace psemek::util
|
|||
return std::sqrt(sum_sqr_ / count_ - m * m);
|
||||
}
|
||||
|
||||
template <typename OStream, typename T>
|
||||
OStream & operator << (OStream & os, statistics<T> const & s)
|
||||
template <typename T>
|
||||
std::ostream & operator << (std::ostream & os, statistics<T> const & s)
|
||||
{
|
||||
os << "mean = " << s.mean() << ", var = " << s.var() << ", range = [" << s.min() << " .. " << s.max() << "]";
|
||||
return os;
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ namespace psemek::test
|
|||
|
||||
}
|
||||
|
||||
template <typename Stream, typename T>
|
||||
Stream & operator << (Stream & s, std::optional<T> const & o)
|
||||
template <typename T>
|
||||
std::ostream & operator << (std::ostream & s, std::optional<T> const & o)
|
||||
{
|
||||
if (o)
|
||||
s << *o;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue