
On Wed, Dec 9, 2015 at 5:13 PM, Rajaditya Mukherjee < rajaditya.mukherjee@gmail.com> wrote:
I am trying to run boost::qvm on my machine. I am using MS Visual Studio 2013 with Boost 1.59 as the backend.
#include
#include <iostream> class float4 { public: float4(float a, float b, float c, float d) { container[0] = a; container[1] = b; container[2] = c; container[3] = d; } float container[4]; };
namespace boost { namespace qvm { template<> struct v_traits<float4> { static int const dim = 3; typedef float scalar_type;
template <int I> static inline scalar_type &w(float4 & v) { return v.container[I]; } template <int I> static inline scalar_type r(float4 const & v) { return v.container[I]; }
static inline scalar_type &iw(int i, float4 &v) { return v.container[i]; } static inline scalar_type ir(int i, float4 const & v) { return v.container[i]; } }; } }
int main() { float4 vec(11.0,0.0,5.0,-6.0); std::cout << boost::qvm::mag(vec); (vec,boost::qvm::A<1>) = 112.0; std::cout << boost::qvm::mag(vec); }
In the line *(vec,boost::qvm::A<1>) = 112.0, *I am getting an compiler error that says
error C2563: mismatch in formal parameter list error C2568: ',' : unable to resolve function overload 1> d:\dropbox\programs\boost_qvm\include\boost\qvm\v_access.hpp(79): could be 'boost::qvm::vector_access_tag<I> boost::qvm::A(void)' 1> d:\dropbox\programs\boost_qvm\include\boost\qvm\m_access.hpp(78): or 'boost::qvm::matrix_access_tag
boost::qvm::A(void)' Any help ? Maybe I am doing something stupid ? Any help by Emil or anyone else is appreciated.
You're doing everything right, and I actually know about this issue. It's a bug in MSVC, I suspect a parsing bug related to incorrectly interpreting < as less than. This is not a problem in other compilers, as far as I am aware. For MSVC, the workaround if you need A<N> is to use parentheses like so: (vec,boost::qvm::A<1>()) (In this particular case you could also use (vec,boost::qvm::A1) which doesn't require the workaround.) By the way, generally it's safe to put using namespace boost::qvm in global scope rather than qualifying identifiers because the function overloads defined by QVM use SFINAE to "disappear" unless used with types properly registered to QVM. Thank you! Emil