인라인 std :: inner_product()는 bug 인 gcc 컴파일러 < gcc 4.1 컴파일러로 인라인되지 않습니다.인라이닝 std :: inner_product
따라서 inner_product의 자체 버전을 구현하고 싶습니다. 기존 구현을 사용할 수 있습니까?
감사
인라인 std :: inner_product()는 bug 인 gcc 컴파일러 < gcc 4.1 컴파일러로 인라인되지 않습니다.인라이닝 std :: inner_product
따라서 inner_product의 자체 버전을 구현하고 싶습니다. 기존 구현을 사용할 수 있습니까?
감사
. 예를 들어, 내 헤더를보고 :
template <class T1, class T2, class T> inline T inner_product(T1 first1, T1 last1, T2 first2, T init)
{
for (; first1 != last1; ++first1, ++first2) init = init + *first1 * *first2; return init;
}
것은 명백한 구현이 같은 보일 것이다 : 같은 짧은 식별자를 사용
// warning: untested code:
template <class I1, class I2, class T>
T inline inner_product(I1 s1, I1 e1, I2 s2, T i) {
while (s1!=e1) {
i = i + ((*(s1)) * (*(s2)));
++(s1);
++(s2);
}
return i;
}
template <class I1, class I2, class T, class B1, class B2>
T inline inner_product(I1 s1, I1 e1, I2 s2, T i, B1 b1, B2 b2) {
while (s1!=e1) {
i=b1(i, b2(*(s1), *(s2)));
++(s1);
++(s2);
}
return i;
}
아마 의문이지만,이 같은 코드를 헤더에 사는 것을 너무 gazillion 번 컴파일 된 짧은 식별자는 구문 분석 시간을 절약합니다 ...
링크가 끊어졌습니다. –
Aghh, fixed it ... – vehomzzz
내가 누락되었거나 세 번째 메시지 (http://www.mail-archive.com/[email protected]/msg200159.html)가 패치? –