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::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::iterator” is not a type name” .
And it accepts this declaration :
typename vector::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 class my_vector:public std::vector )!
Thanks to think to help me if you have any ideas !
my_vector.h:
using namespace std;
template
class my_vector:public vector{
using vector::operator;
using vector::begin;
using vector::end;
using vector::resize;
using vector::size;
using vector::iterator;
my_vector(unsigned _size = 0, EOT _value = EOT())
:vector(_size, _value)
{}
/* My compilator nvcc don’t agree this declaration*/
typename my_vector::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;
}
*/
}