]> Dogcows Code - chaz/yoink/blobdiff - src/cml/vector/vector_print.h
testing new non-autotools build system
[chaz/yoink] / src / cml / vector / vector_print.h
diff --git a/src/cml/vector/vector_print.h b/src/cml/vector/vector_print.h
new file mode 100644 (file)
index 0000000..7106b32
--- /dev/null
@@ -0,0 +1,45 @@
+/* -*- C++ -*- ------------------------------------------------------------
+Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
+
+The Configurable Math Library (CML) is distributed under the terms of the
+Boost Software License, v1.0 (see cml/LICENSE for details).
+
+ *-----------------------------------------------------------------------*/
+/** @file
+ *  @brief
+ */
+
+#ifndef vector_print_h
+#define vector_print_h
+
+#include <iostream>
+
+namespace cml {
+
+/** Output a vector to a std::ostream. */
+template<typename E, class AT > inline std::ostream&
+operator<<(std::ostream& os, const vector<E,AT>& v)
+{
+    for (size_t i = 0; i < v.size(); ++i) {
+        os << " " << v[i];
+    }
+    return os;
+}
+
+/** Output a vector expression to a std::ostream. */
+template< class XprT > inline std::ostream&
+operator<<(std::ostream& os, const et::VectorXpr<XprT>& v)
+{
+    for (size_t i = 0; i < v.size(); ++i) {
+        os << " " << v[i];
+    }
+    return os;
+}
+
+} // namespace cml
+
+#endif
+
+// -------------------------------------------------------------------------
+// vim:ft=cpp
This page took 0.021308 seconds and 4 git commands to generate.