Thursday, December 21, 2006

Inline in C++

The double vector sorting and addition functions are defined as inline using the inline keyword.

Code:
//MyMath.h
inline int sort_vector_inline_new(vector<double>& v){ //new inline
sort(v.begin(),v.end());
return 1;
}
inline int add_inline_new(int a,int b){
return a+b;
}


Result:(Speed test)

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home