]> Dogcows Code - chaz/yoink/blobdiff - src/cml/quaternion/quaternion_traits.h
now using cml for vectors and math stuff
[chaz/yoink] / src / cml / quaternion / quaternion_traits.h
diff --git a/src/cml/quaternion/quaternion_traits.h b/src/cml/quaternion/quaternion_traits.h
new file mode 100644 (file)
index 0000000..fbf23cf
--- /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 quaternion_traits_h
+#define quaternion_traits_h
+
+#include <cml/et/traits.h>
+
+namespace cml {
+namespace et {
+
+/** Expression traits for a quaternion<> type. */
+template<typename E, class AT, class OT, class CT>
+struct ExprTraits< cml::quaternion<E,AT,OT,CT> >
+{
+    typedef typename cml::quaternion<E,AT,OT,CT>::expr_type expr_type;
+    typedef typename expr_type::value_type value_type;
+    typedef typename expr_type::expr_reference reference;
+    typedef typename expr_type::expr_const_reference const_reference;
+    typedef typename expr_type::result_tag result_tag;
+    typedef typename expr_type::size_tag size_tag;
+    typedef typename expr_type::assignable_tag assignable_tag;
+    typedef expr_type result_type;
+    typedef expr_leaf_tag node_tag;
+
+    value_type get(const expr_type& v, size_t i) const { return v[i]; }
+    size_t size(const expr_type& v) const { return 4; }
+};
+
+} // namespace et
+} // namespace cml
+
+#endif
+
+// -------------------------------------------------------------------------
+// vim:ft=cpp
This page took 0.024977 seconds and 4 git commands to generate.