<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I found a strange error when I try the vec3 sample from proto, my code is like this:<br><br>struct Vec3SubscriptCtx<br>&nbsp; : proto::callable_context&lt; Vec3SubscriptCtx const &gt;<br>{<br>&nbsp;&nbsp;&nbsp; typedef int result_type;<br><br>&nbsp;&nbsp;&nbsp; Vec3SubscriptCtx(int i)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : i_(i)<br>&nbsp;&nbsp;&nbsp; {}<br><br>&nbsp;&nbsp;&nbsp; // Index array terminals with our subscript. Everything<br>&nbsp;&nbsp;&nbsp; // else will be handled by the default evaluation context.<br>&nbsp;&nbsp;&nbsp; int operator ()(proto::tag::terminal, int const (&amp;arr)[3]) const<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return arr[this-&gt;i_];<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; int i_;<br>};<br>struct Vec3<br>&nbsp; : proto::extends&lt;proto::terminal&lt;int[3]&gt;::type,
 Vec3&gt;<br>{<br>&nbsp;&nbsp; explicit Vec3(int i=0, int j=0, int k=0)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[0] = i;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[1] = j;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[2] = k;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; int &amp;operator [](int i)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return proto::value(*this)[i];<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; int const &amp;operator [](int i) const<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return proto::value(*this)[i];<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; // Here we define a operator = for Vec3 terminals that<br>&nbsp;&nbsp;&nbsp; // takes a Vec3 expression.<br>&nbsp;&nbsp;&nbsp; template&lt; typename Expr &gt;<br>&nbsp;&nbsp;&nbsp; Vec3 &amp;operator =(Expr const &amp; expr)<br>&nbsp;&nbsp;&nbsp;
 {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef Vec3SubscriptCtx const CVec3SubscriptCtx;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[0] = proto::eval(proto::as_expr(expr), CVec3SubscriptCtx(0));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[1] = proto::eval(proto::as_expr(expr), CVec3SubscriptCtx(1));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[2] = proto::eval(proto::as_expr(expr), CVec3SubscriptCtx(2));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return *this;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; template&lt; typename Expr &gt;<br>&nbsp;&nbsp;&nbsp; Vec3 (Expr const &amp; expr)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef Vec3SubscriptCtx const CVec3SubscriptCtx;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[0] = proto::eval(proto::as_expr(expr), CVec3SubscriptCtx(0));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[1] = proto::eval(proto::as_expr(expr),
 CVec3SubscriptCtx(1));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*this)[2] = proto::eval(proto::as_expr(expr), CVec3SubscriptCtx(2));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; void print() const<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; '{' &lt;&lt; (*this)[0]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; ", " &lt;&lt; (*this)[1]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; ", " &lt;&lt; (*this)[2]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; '}' &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; }<br>};<br>int main(int argc, const char* argv[])<br>{<br>&nbsp;&nbsp;&nbsp; Vec3 a(1, 2, 3);<br>&nbsp;&nbsp;&nbsp; Vec3 b(3, 2, 1);<br>&nbsp;&nbsp;&nbsp; Vec3
 c;<br>&nbsp;&nbsp;&nbsp; c = b;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; c.print();<br><br>&nbsp;&nbsp;&nbsp; return 0;<br>}<br><br>I expected that when c is printed it will display 3, 2, 1 ( the value of b ) but instead it print 0,0,0 like b is never assigned to c. I try this using vs 2010 with boost 1.44 in windows 7 64.<br></td></tr></table><br>