Inlining std::inner_product

B

Bo Persson

puzzlecracker said:
Allegedly inlining std::inner_product() does NOT work with > gcc 4.0
compilers, per the following
http://www.mail-archive.com/[email protected]/msg200154.html.

Hence I would like to implement my own version of inner_product. Are
there existing implementation available?

Thanks

You mean something like this?

template<class _InputIterator1, class _InputIterator2, class _NumT>
inline _NumT inner_product(_InputIterator1 _First, _InputIterator1
_Last,
_InputIterator2 _Second, _NumT _Value)
{
for ( ; _First != _Last; ++_First, ++_Second)
_Value = _Value + *_First * *_Second;

return _Value;
}


Bo Persson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,413
Latest member
KeiraLight

Latest Threads

Top