1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
2 
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #include <boost/qvm/deduce_mat.hpp>
7 
8 template <class T,class U>
9 struct same_type;
10 
11 template <class T>
12 struct
13 same_type<T,T>
14     {
15     };
16 
17 template <class A,class B,int R,int C,class Result>
18 struct
19 check
20     {
21     same_type<typename boost::qvm::deduce_mat2<A,B,R,C>::type,Result> a;
22     same_type<typename boost::qvm::deduce_mat2<B,A,R,C>::type,Result> b;
23     };
24 
25 template <class T,int R,int C> struct m;
26 
27 namespace
28 boost
29     {
30     namespace
31     qvm
32         {
33         template <class T,int R,int C>
34         struct
35         mat_traits< m<T,R,C> >
36             {
37             typedef T scalar_type;
38             static int const rows=R;
39             static int const cols=C;
40             };
41         }
42     }
43 
44 int
main()45 main()
46     {
47     same_type< boost::qvm::deduce_mat< m<int,4,2> >::type, m<int,4,2> >();
48     same_type< boost::qvm::deduce_mat< m<int,4,2>, 4, 4 >::type, boost::qvm::mat<int,4,4> >();
49     check< m<int,4,2>, m<int,4,2>, 4, 2, m<int,4,2> >();
50     check< m<int,4,2>, m<float,4,2>, 4, 4, boost::qvm::mat<float,4,4> >();
51     }
52