Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  


C++ templates are fun. I hadn't gotten "warning C4503: decorated name length exceeded, name was truncated" in MSVS since I stopped using 6 years ago, but just now I had a project gain 85 such warnings after adding some classes like the following:
template 	typename TMemberType,
const TMemberType TClassType::*const TMemberPtr,
typename TPredicate = std::less >
struct TMemberCompare
const TPredicate m_Predicate;
TMemberCompare(const TPredicate& p_Predicate)
bool operator()(const TClassType &p_Left, const TClassType &p_Right) const
return m_Predicate(p_Left.*TMemberPtr, p_Right.*TMemberPtr);
Is there a better way to make such comparison functors? I looked around in MSDN and Boost for such wrapper classes, but I couldn't find them so I created the above, another that derefs it's arguments and compares the result (for iterators), and a third that does a lexicographical_compare on two provided containers.
Of course, in some cases, they are chained, which causes the problem:
typedef TIteratorCompare TSymbolRefCompare;
typedef TContainerCompare TSymbolRefListCompare;
typedef TMemberCompare TExpressionCompare;
typedef TIteratorCompare TExpressionRefCompare;
typedef TContainerCompare TExpressionRefTableCompare;
//TExpressionRefTableCompare is used in a custom comparison functor for TAssertionCompare to make TAssertionTable

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!