const_cast_ptr is not inlined on MSVC 2013
Submitted by Emily
Assigned to Nobody
Link to original bugzilla bug (#898)
Version: 3.2
Operating system: Windows
Description
Visual Studio has a thing where it will some times refuse to inline even the most obvious functions unless you specify that is should, by using the inline
keyword.
In an optimized build I get non-inlined calls to:
src\core\util\xprhelper.h:343
template<typename T>
T* const_cast_ptr(const T* ptr)
{
return const_cast<T*>(ptr);
}
Related ASM:
--- d:\work\include\eigen\src\core\util\xprhelper.h --------------------
mov rax,rcx
ret
Callsite:
lea rcx,[rax+rcx*8]
call Eigen::internal::const_cast_ptr<double> (013F4C8215h)
mov r14,qword ptr [r14+8]
I propose to add the inline
keyword to const_cast_ptr to make MSVC inline it. I have done it locally and it has the intended effect.