Fixes https://github.com/Itseez/opencv_contrib/issues/332 Relevant material: http://stackoverflow.com/questions/6066273/pointer-into-vector-but-not-into-a-valarray http://objectmix.com/c/40001-address-first-member-valarray.html http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#389 I have to admit my naivety here, this issue is was complex for me to diagnose. It appears that in the MSVC 2008/2010 implementation of std::valarray, when indexing and assigning to a const variable, that the const version of the member function valarray<T>::operator[](size_t) returns a value instead of a const-reference. Therefore, taking the address of this is a compiler error as you can't take the address of an lvalue. By performing a const_cast on the array we change which function is called and thus we actually do recieve a const-reference. This should not effect other compilers.pull/338/head
parent
8682d7d054
commit
c8986b13fc
1 changed files with 1 additions and 1 deletions
Loading…
Reference in new issue