J
Jacobo Rodriguez Villar
Hello,
I'm trying to use the find algo from the stl library, over a list of
pointers:
std::list<Program *> m_programs
in this method:
Program *GLSLManager::GetProgram(GLhandleARB id)
{
std::list<Program *>::iterator result;
result = find(m_programs.begin(), m_programs.end(), id);
if(result!=m_programs.end())
return *result;
else
return NULL;
}
As far I know I must implement the operator== between the types
GLhandleARB (it is a typedef of ints) and Program * pointers. I do this
by this way:
int operator==(Program *program, GLhandleARB id); /*it is not a member
of Program class*/
[implementation]
int operator==(Program *program, GLhandleARB id)
{
return program->GetHandle() == id;
}
but I'm having errors with this:
error C2803: 'operator == must have at least a formal parameter of class
type'
Anyone can help me?
thanks in advance
--
Jacobo Rodríguez Villar
TyphoonLabs Lead Programmer
http://www.typhoonlabs.com
I'm trying to use the find algo from the stl library, over a list of
pointers:
std::list<Program *> m_programs
in this method:
Program *GLSLManager::GetProgram(GLhandleARB id)
{
std::list<Program *>::iterator result;
result = find(m_programs.begin(), m_programs.end(), id);
if(result!=m_programs.end())
return *result;
else
return NULL;
}
As far I know I must implement the operator== between the types
GLhandleARB (it is a typedef of ints) and Program * pointers. I do this
by this way:
int operator==(Program *program, GLhandleARB id); /*it is not a member
of Program class*/
[implementation]
int operator==(Program *program, GLhandleARB id)
{
return program->GetHandle() == id;
}
but I'm having errors with this:
error C2803: 'operator == must have at least a formal parameter of class
type'
Anyone can help me?
thanks in advance
--
Jacobo Rodríguez Villar
TyphoonLabs Lead Programmer
http://www.typhoonlabs.com