]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - Vc/include/Vc/IO
update to Vc 0.7.3-dev
[u/mrichter/AliRoot.git] / Vc / include / Vc / IO
index 63668bf8af090134840a1307001e21e675915173..084b8d94dec60c5807cf3454f5eefea42a6e22cb 100644 (file)
 #include "Memory"
 #include <iostream>
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(_WIN32) && defined(_GLIBCXX_OSTREAM)
+#define VC_HACK_OSTREAM_FOR_TTY 1
+#endif
+
+#ifdef VC_HACK_OSTREAM_FOR_TTY
 #include <unistd.h>
 #include <ext/stdio_sync_filebuf.h>
 #endif
@@ -42,15 +46,13 @@ namespace
         static const Type normal = { "\033[0m" };
     } // namespace AnsiColor
 
-#ifdef __GNUC__
+#ifdef VC_HACK_OSTREAM_FOR_TTY
     class hacked_ostream : public std::ostream
     {
         public:
             using std::ostream::_M_streambuf;
     };
-    static bool mayUseColor(const std::ostream &os)
-        __attribute__((__const__));
-    static bool mayUseColor(const std::ostream &os)
+    __attribute__((__const__)) bool mayUseColor(const std::ostream &os)
     {
         std::basic_streambuf<char> *hack1 = const_cast<std::basic_streambuf<char> *>(os.*(&hacked_ostream::_M_streambuf));
         __gnu_cxx::stdio_sync_filebuf<char> *hack = dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char> *>(hack1);
@@ -61,13 +63,13 @@ namespace
         return 1 == isatty(fileno(file));
     }
 #else
-    static bool mayUseColor(const std::ostream &) { return false; }
+    inline bool mayUseColor(const std::ostream &) { return false; }
 #endif
 } // anonymous namespace
 
 namespace std
 {
-static inline std::ostream &operator<<(std::ostream &out, const AnsiColor::Type &c)
+inline std::ostream &operator<<(std::ostream &out, const AnsiColor::Type &c)
 {
     if (mayUseColor(out)) {
         out << c.data;
@@ -76,7 +78,7 @@ static inline std::ostream &operator<<(std::ostream &out, const AnsiColor::Type
 }
 
 template<typename T>
-static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<T> &v)
+inline std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<T> &v)
 {
     out << AnsiColor::green << "[";
     out << v[0];
@@ -87,7 +89,7 @@ static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vecto
     return out;
 }
 
-static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<char> &v)
+inline std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<char> &v)
 {
     out << AnsiColor::green << "[";
     out << int(v[0]);
@@ -97,7 +99,7 @@ static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vecto
     out << "]" << AnsiColor::normal;
     return out;
 }
-static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<unsigned char> &v)
+inline std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<unsigned char> &v)
 {
     out << AnsiColor::green << "[";
     out << int(v[0]);
@@ -110,7 +112,7 @@ static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vecto
 
 #ifdef VC_HAVE_FMA
 template<typename T>
-static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::VectorMultiplication<T> &v)
+inline std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::VectorMultiplication<T> &v)
 {
     return out << VECTOR_NAMESPACE::Vector<T>(v);
 }
@@ -118,10 +120,10 @@ static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vecto
 
 #ifdef VC_IMPL_AVX
 template<unsigned int VectorSize, size_t RegisterWidth>
-static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Mask<VectorSize, RegisterWidth> &m)
+inline std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Mask<VectorSize, RegisterWidth> &m)
 #else
 template<unsigned int VectorSize>
-static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Mask<VectorSize> &m)
+inline std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Mask<VectorSize> &m)
 #endif
 {
     out << AnsiColor::blue << "m[";
@@ -138,8 +140,8 @@ static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Mask<
     out << AnsiColor::blue << "]" << AnsiColor::normal;
     return out;
 }
-#if VC_IMPL_SSE
-static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Float8Mask &m)
+#ifdef VC_IMPL_SSE
+inline std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Float8Mask &m)
 {
     out << AnsiColor::blue << "m[";
     for (unsigned int i = 0; i < 8; ++i) {
@@ -158,7 +160,7 @@ static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Float
 #endif
 
 template<typename V, typename Parent, typename RM>
-static std::ostream &operator<<(std::ostream &out, const Vc::MemoryBase<V, Parent, 1, RM> &m )
+inline std::ostream &operator<<(std::ostream &out, const Vc::MemoryBase<V, Parent, 1, RM> &m )
 {
     out << AnsiColor::blue << "{" << AnsiColor::normal;
     for (unsigned int i = 0; i < m.vectorsCount(); ++i) {
@@ -169,7 +171,7 @@ static std::ostream &operator<<(std::ostream &out, const Vc::MemoryBase<V, Paren
 }
 
 template<typename V, typename Parent, typename RM>
-static std::ostream &operator<<(std::ostream &out, const Vc::MemoryBase<V, Parent, 2, RM> &m )
+inline std::ostream &operator<<(std::ostream &out, const Vc::MemoryBase<V, Parent, 2, RM> &m )
 {
     out << AnsiColor::blue << "{" << AnsiColor::normal;
     for (size_t i = 0; i < m.rowsCount(); ++i) {