views:

42

answers:

1

I was trying to use the OMPTL in Visual Studio. As far as I understand it, I only need to set the /openmp option, in order for the OMPTL to use the multi-threaded implementation of some stl functions.

When I don't use /openmp everything is fine and OMPTL maps the functions to their normal stl counter parts, without multi-threading. With /openmp however, I get a compiler error:

Error 1 error C2572: 'omptl::transform_accumulate' : redefinition of default parameter : parameter 6 ..\include\omptl\omptl_numeric_extentions_par.h 132

The line in question says

template <class Iterator, class T, class UnaryFunction, class BinaryFunction>
T transform_accumulate(Iterator first, Iterator last, const T init,
   UnaryFunction unary_op, BinaryFunction binary_op,
   const unsigned P = omp_get_max_threads())
{
 return ::omptl::_TransformAccumulate
 <typename ::std::iterator_traits<Iterator>::iterator_category>
  ::transform_accumulate(first, last, init,
     unary_op, binary_op, P);
}

Is there a way to fix this or is the OMPTL simply not usable with Microsoft's compiler?

A: 

The compiler does not seem to accept default parameters in this template declaration. Removing '= omp_get_max_threads()' from both declarations solved the problem for me.

Marc
Yes, I was thinking of doing that, however I don't remember if I actually tried it and if any other issues occurred then. I'll try if I get around to that project again :).
Spooky