
I should explain that the previous was a simple outline. I was thinking trap_1d::operator() does the complete integration. It will need more information to specify the desired precision. I'm thinking these additional arguments could be passed to trap_1d::operator() or could be constructor args. The reason trap_1d is a functor is just because I wanted to have arg_t and res_t be template parameters, and I wanted to have default values for them. This gives the best of all worlds. You can overide these types by specifying non-defaults, or you can specialize the arg or res templates, or you can use the default arg and res templates which are designed to work with functions of the style std::unary_function (sorry, I didn't check the spellings on the type names).