   (VS .NET) C2091: function returns function
  I'm getting the above error on the following line of code:template< typename T > struct DXComponentZMapper{typedef unsigned int KeyType;const KeyType getKey()(const T& o){ return o->getZOrder(); } // Compiler error here...};    which is declared in this:TSortTree< DXComponent*, DXComponentZMapper > CompTree;    where TSortTree has the following declaration:template<typename T, template< class > class MappingPolicy = TrivialKeyMapper, template< class > class AllocatorPolicy = StandardNodeAllocator, template< class > class BalancerPolicy = NeverTreeBalancer >class TSortTree {// ....};    Does anybody know why this happens?  Does it have anything to do with including STL ?Thanks a lot,JeffEdit: Fixed the angle brackets...grr[edited by - rypyr on February 3, 2004 10:28:56 AM]
  Exactly what is says on the tin. You''re dereferencing the function. Change it toreturn o.getZOrder();  ;  Nope, as the code indicates, it is constructed with a pointer to a DXComponent, not a DXComponent object in this line:TSortTree< DXComponent*, DXComponentZMapper > CompTree;Thus, the code o->getZOrder() should be correct. ;  ARGH!  What a ridiculous typo:const KeyType& getKey()(const T& o)should have beenconst KeyType& getKey(const T& o)The reason for such stupidity is that I used to have this function as operator() and changed it to a named function!Regards,Jeff ;  Well done.  [edited by - mathematix on February 3, 2004 11:09:34 AM]