-
Patrick Snape authored
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.
c8986b13
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
adas | ||
bgsegm | ||
bioinspired | ||
ccalib | ||
contrib_world | ||
cvv | ||
datasets | ||
datasetstools | ||
face | ||
latentsvm | ||
line_descriptor | ||
matlab | ||
optflow | ||
reg | ||
rgbd | ||
saliency | ||
stereo | ||
surface_matching | ||
text | ||
tracking | ||
xfeatures2d | ||
ximgproc | ||
xobjdetect | ||
xphoto | ||
README.md |