| 1 | // Copyright 2008-2022 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 | #ifdef BOOST_QVM_TEST_SINGLE_HEADER |
| 7 | # include BOOST_QVM_TEST_SINGLE_HEADER |
| 8 | # ifdef BOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE |
| 9 | # include BOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE |
| 10 | # endif |
| 11 | #else |
| 12 | # include <boost/qvm/vec_traits.hpp> |
| 13 | # include <boost/qvm/swizzle2.hpp> |
| 14 | #endif |
| 15 | |
| 16 | #include <boost/core/lightweight_test.hpp> |
| 17 | |
| 18 | template <int D> struct my_vec { }; |
| 19 | int called=0; |
| 20 | |
| 21 | namespace |
| 22 | boost |
| 23 | { |
| 24 | namespace |
| 25 | qvm |
| 26 | { |
| 27 | void |
| 28 | XX(...) |
| 29 | { |
| 30 | BOOST_TEST(0); |
| 31 | } |
| 32 | void |
| 33 | XY(...) |
| 34 | { |
| 35 | ++called; |
| 36 | } |
| 37 | template <int D> |
| 38 | struct |
| 39 | vec_traits< my_vec<D> > |
| 40 | { |
| 41 | typedef int scalar_type; |
| 42 | static int const dim=D; |
| 43 | template <int I> static int read_element( my_vec<D> const & ); |
| 44 | template <int I> static int & write_element( my_vec<D> & ); |
| 45 | }; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | int |
| 50 | main() |
| 51 | { |
| 52 | using namespace boost::qvm; |
| 53 | XX(a: my_vec<1>()); |
| 54 | XY(my_vec<1>()); |
| 55 | BOOST_TEST(called==1); |
| 56 | return boost::report_errors(); |
| 57 | } |
| 58 | |