]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/qvm/test/deduce_vector_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / qvm / test / deduce_vector_test.cpp
CommitLineData
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
8template <class T,class U>
9struct same_type;
10
11template <class T>
12struct
13same_type<T,T>
14 {
15 };
16
17template <class A,class B,int D,class Result>
18struct
19check
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
25template <class T,int D> struct v;
26
27namespace
28boost
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
43int
44main()
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 }