#ifndef BOOST_QVM_VEC_ACCESS_HPP_INCLUDED #define BOOST_QVM_VEC_ACCESS_HPP_INCLUDED /// Copyright (c) 2008-2021 Emil Dotchevski and Reverge Studios, Inc. /// Distributed under the Boost Software License, Version 1.0. (See accompanying /// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include namespace boost { namespace qvm { template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c< is_vec::value, typename vec_traits::scalar_type>::type A( V const & a ) { BOOST_QVM_STATIC_ASSERT(I>=0); BOOST_QVM_STATIC_ASSERT(I::dim); return vec_traits::template read_element(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c< is_vec::value, typename vec_traits::scalar_type &>::type A( V & a ) { BOOST_QVM_STATIC_ASSERT(I>=0); BOOST_QVM_STATIC_ASSERT(I::dim); return vec_traits::template write_element(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type X( V const & a ) { BOOST_QVM_STATIC_ASSERT(0::dim); return vec_traits::template read_element<0>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type Y( V const & a ) { BOOST_QVM_STATIC_ASSERT(1::dim); return vec_traits::template read_element<1>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type Z( V const & a ) { BOOST_QVM_STATIC_ASSERT(2::dim); return vec_traits::template read_element<2>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type W( V const & a ) { BOOST_QVM_STATIC_ASSERT(3::dim); return vec_traits::template read_element<3>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type X( V & a ) { BOOST_QVM_STATIC_ASSERT(0::dim); return vec_traits::template write_element<0>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type Y( V & a ) { BOOST_QVM_STATIC_ASSERT(1::dim); return vec_traits::template write_element<1>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type Z( V & a ) { BOOST_QVM_STATIC_ASSERT(2::dim); return vec_traits::template write_element<2>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type W( V & a ) { BOOST_QVM_STATIC_ASSERT(3::dim); return vec_traits::template write_element<3>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A0( V const & a ) { BOOST_QVM_STATIC_ASSERT(0::dim); return vec_traits::template read_element<0>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A1( V const & a ) { BOOST_QVM_STATIC_ASSERT(1::dim); return vec_traits::template read_element<1>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A2( V const & a ) { BOOST_QVM_STATIC_ASSERT(2::dim); return vec_traits::template read_element<2>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A3( V const & a ) { BOOST_QVM_STATIC_ASSERT(3::dim); return vec_traits::template read_element<3>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A4( V const & a ) { BOOST_QVM_STATIC_ASSERT(4::dim); return vec_traits::template read_element<4>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A5( V const & a ) { BOOST_QVM_STATIC_ASSERT(5::dim); return vec_traits::template read_element<5>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A6( V const & a ) { BOOST_QVM_STATIC_ASSERT(6::dim); return vec_traits::template read_element<6>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A7( V const & a ) { BOOST_QVM_STATIC_ASSERT(7::dim); return vec_traits::template read_element<7>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A8( V const & a ) { BOOST_QVM_STATIC_ASSERT(8::dim); return vec_traits::template read_element<8>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type>::type A9( V const & a ) { BOOST_QVM_STATIC_ASSERT(9::dim); return vec_traits::template read_element<9>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A0( V & a ) { BOOST_QVM_STATIC_ASSERT(0::dim); return vec_traits::template write_element<0>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A1( V & a ) { BOOST_QVM_STATIC_ASSERT(1::dim); return vec_traits::template write_element<1>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A2( V & a ) { BOOST_QVM_STATIC_ASSERT(2::dim); return vec_traits::template write_element<2>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A3( V & a ) { BOOST_QVM_STATIC_ASSERT(3::dim); return vec_traits::template write_element<3>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A4( V & a ) { BOOST_QVM_STATIC_ASSERT(4::dim); return vec_traits::template write_element<4>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A5( V & a ) { BOOST_QVM_STATIC_ASSERT(5::dim); return vec_traits::template write_element<5>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A6( V & a ) { BOOST_QVM_STATIC_ASSERT(6::dim); return vec_traits::template write_element<6>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A7( V & a ) { BOOST_QVM_STATIC_ASSERT(7::dim); return vec_traits::template write_element<7>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A8( V & a ) { BOOST_QVM_STATIC_ASSERT(8::dim); return vec_traits::template write_element<8>(a); } template BOOST_QVM_INLINE_TRIVIAL typename enable_if_c::value,typename vec_traits::scalar_type &>::type A9( V & a ) { BOOST_QVM_STATIC_ASSERT(9::dim); return vec_traits::template write_element<9>(a); } } } #endif