forked from boostorg/function
Testcases autogenerated from the Boost.Function tutorial
[SVN r16711]
This commit is contained in:
24
test/sum_avg_cxx98.cpp
Normal file
24
test/sum_avg_cxx98.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
void do_sum_avg(int values[], int n, int& sum, float& avg)
|
||||
{
|
||||
sum = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
sum += values[i];
|
||||
avg = (float)sum / n;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
boost::function<void (int values[], int n, int& sum, float& avg)> sum_avg;
|
||||
|
||||
|
||||
sum_avg = &do_sum_avg;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user