I try to simplify my problem in order to let you get it easily for this reason i prefered working in small project with 4 files :
my_vector.cu : program which initialise host & device vectors and launch kernel_function.
my_vector_kernel.cu : program which declare a kernel function.
my_vector.h : header where i declare a simple class which use standard template library.
and finally my CMakeLists.txt.
Then for having a better idea about my project i will attach code source below.
The problem it s when i include my header file my compiler (nvcc) does not accept this declaration :
typename my_vector<EOT>::iterator it_best_element()
{
typename my_vector<EOT>::iterator it = std::max_element(begin(), end());
return it;
}
it gives me this kind of error : "my_vector.h(22): error: nontype "my_vector<EOT>::iterator" is not a type name" .
And it accepts this declaration :
typename vector<EOT>::iterator it_best_element()
{
typename vector<EOT>::iterator it = max_element(begin(), end());
return it;
}
knowing that my class "my_vector" inherited from std::vector ( template <typename EOT> class my_vector:public std::vector<EOT> )!
Thanks to think to help me if you have any ideas !
my_vector.h:
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;
template <typename EOT>
class my_vector:public vector<EOT>{
using vector<EOT>::operator[];
using vector<EOT>::begin;
using vector<EOT>::end;
using vector<EOT>::resize;
using vector<EOT>::size;
using vector<EOT>::iterator;
/* My compilator nvcc don't agree this declaration*/
typename my_vector<EOT>::iterator it_best_element()
{
typename my_vector<EOT>::iterator it = std::max_element(begin(), end());
return it;
}
/* My compilator nvcc accept this use of my iterator */
/*
typename vector<EOT>::iterator it_best_element()
{
typename vector<EOT>::iterator it = max_element(begin(), end());
return it;
}
*/
}