Hi all, I am creating a bunch of function for channel merging, thus I was looking in channel_algorithm.hpp and I saw something that may slow down processes... I don't know if I'm right, but on line 362: /// \ingroup ChannelConvertAlgorithm
/// \brief Converting from one channel type to another. template
// Model ChannelConcept (could be channel references) inline typename channel_traits<DstChannel>::value_type channel_convert(*SrcChannel src*) { return channel_converter ()(src); }
There is no reference on parameter ***src*.* *That* *not* *a very good idea because references aren't hold by templates function (even if inlined). This may invoke copy constructor and can slow down the processes a "lot"... Here is an example that shows I'm right in theory: // "Slow" on big objects
template<typename P> inline void testPtr1(P a) { std::cout << "In called function inequality ptr of a: " << (int)&a << std::endl; }
// Better template<typename P> inline void testPtr2(P &a) { std::cout << "In called function equality ptr of a: " << (int)&a << std::endl; }
template<typename P> void test(const P & a) { std::cout << "Base ptr of a: " << (int)&a << std::endl; testPtr1(a); }
int main() { int a = 0; test(a); return 0; }