R
rg
Hi all,
I was wondering if anyone had dealt with a similar problem. I need to use a
template function as the parameter for a particular function (also template
function).
The program compiles into an object file but then at the final stage it says
that it can't find template function. The platform is WindowsXP Pro, MSCV++
..Net.
More specifically what I want to do is write an atl algorithm that will also
accept another algorithm as a function parameter. This is inteface of the
outer algorithm:
template <class iterator, class outiterator, class Alg>
void transform_slide ( iterator begin, iterator end, outiterator
outbegin, std::size_t slide, Alg alg)
{
std::size_t loop = std::distance( begin, end) / slide;
for ( std::size_t x = 0; x < loop; ++x, ++outbegin, begin =
std::advance( begin, size) ) // only do complete cycles, not parts
*outbegin = alg( begin, std::advance( begin, size) );
}
What I want to do with is perform some calculations on range on a sliding
basis. For example, if I have a array of 1000 values, I may want to
calculate the average of every 100 of those values.
Any help would be appreciated. Many Thanks in advance.
RG
I was wondering if anyone had dealt with a similar problem. I need to use a
template function as the parameter for a particular function (also template
function).
The program compiles into an object file but then at the final stage it says
that it can't find template function. The platform is WindowsXP Pro, MSCV++
..Net.
More specifically what I want to do is write an atl algorithm that will also
accept another algorithm as a function parameter. This is inteface of the
outer algorithm:
template <class iterator, class outiterator, class Alg>
void transform_slide ( iterator begin, iterator end, outiterator
outbegin, std::size_t slide, Alg alg)
{
std::size_t loop = std::distance( begin, end) / slide;
for ( std::size_t x = 0; x < loop; ++x, ++outbegin, begin =
std::advance( begin, size) ) // only do complete cycles, not parts
*outbegin = alg( begin, std::advance( begin, size) );
}
What I want to do with is perform some calculations on range on a sliding
basis. For example, if I have a array of 1000 values, I may want to
calculate the average of every 100 of those values.
Any help would be appreciated. Many Thanks in advance.
RG