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