Tuesday 1 October 2013

c++ templates how to call a template from one file that needs access to template of another file.

c++ templates how to call a template from one file that needs access to
template of another file.

I am new to template and as an exercise , I am trying to write my own
template iterator in one file and later on use that iterator in find
algorithm in another file.
e.g. in myfind.h I have
#ifndef my_find_header
#define my_find_header
template <typename T, typename TIter>
inline
TIter * find (TIter * start , TIter * stop , const T & value)
{
while ((start != stop ) && (*start == value))
{
start++;
}
return start;
}

No comments:

Post a Comment