]>
Commit | Line | Data |
---|---|---|
92f5a8d4 TL |
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_vec.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 D,class Result> | |
18 | struct | |
19 | check | |
20 | { | |
21 | same_type<typename boost::qvm::deduce_vec2<A,B,D>::type,Result> a; | |
22 | same_type<typename boost::qvm::deduce_vec2<B,A,D>::type,Result> b; | |
23 | }; | |
24 | ||
25 | template <class T,int D> struct v; | |
26 | ||
27 | namespace | |
28 | boost | |
29 | { | |
30 | namespace | |
31 | qvm | |
32 | { | |
33 | template <class T,int D> | |
34 | struct | |
35 | vec_traits< v<T,D> > | |
36 | { | |
37 | typedef T scalar_type; | |
38 | static int const dim=D; | |
39 | }; | |
40 | } | |
41 | } | |
42 | ||
43 | int | |
44 | main() | |
45 | { | |
46 | same_type< boost::qvm::deduce_vec< v<int,3> >::type, v<int,3> >(); | |
47 | same_type< boost::qvm::deduce_vec< v<int,3>, 4 >::type, boost::qvm::vec<int,4> >(); | |
48 | check< v<int,3>, v<int,3>, 3, v<int,3> >(); | |
49 | check< v<int,3>, v<float,3>, 4, boost::qvm::vec<float,4> >(); | |
50 | } |