Click here to Skip to main content
15,888,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Could someone please explain why the following code is giving error (error C2065: 'select' : undeclared identifier) at compile time:
namespace N 
{ 
  class MyClass 
  { 
  };

  template<int I> void select(MyClass*)
  {
  }
}

void g (N::MyClass* mp) 
{ 
  select<10>(mp); 
}

void main()
{
}


I was reading a book. According to Argument dependent look-up rule, this should work fine, since i have specified 'N::' in g`s argument. So, "select()" should be visible to the compiler.
Posted
Updated 26-Oct-13 3:46am
v2

The select function is part of namespace N. Hence you should reference it by
C++
N::select<10> (mp);
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900