2006-09-15 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
* xtd/vec.hh (operator-): Fix missing const.
(mk_vec): New.
Index: xtd/vec.hh
===================================================================
--- xtd/vec.hh (revision 542)
+++ xtd/vec.hh (working copy)
@@ -203,7 +203,7 @@
}
vec<n, xtd_op_uminus_trait(T)>
- operator-()
+ operator-() const
{
vec<n, xtd_op_uminus_trait(T)> tmp;
for (unsigned i = 0; i < n; ++i)
@@ -311,6 +311,37 @@
};
+
+ /// mk_vec.
+
+ template <typename T>
+ vec<1, T> mk_vec(const T& v_0)
+ {
+ vec<1, T> tmp;
+ tmp[0] = v_0;
+ return tmp;
+ }
+
+ template <typename T>
+ vec<2, T> mk_vec(const T& v_0, const T& v_1)
+ {
+ vec<2, T> tmp;
+ tmp[0] = v_0;
+ tmp[1] = v_1;
+ return tmp;
+ }
+
+ template <typename T>
+ vec<3, T> mk_vec(const T& v_0, const T& v_1, const T& v_2)
+ {
+ vec<3, T> tmp;
+ tmp[0] = v_0;
+ tmp[1] = v_1;
+ tmp[2] = v_2;
+ return tmp;
+ }
+
+
} // end of namespace xtd
Show replies by date