On Nov 19, 2008, at 8:21 AM, Sebastian Redl wrote: > Chris Lattner wrote: >> Author: lattner >> Date: Wed Nov 19 01:49:14 2008 >> New Revision: 59605 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=59605&view=rev >> Log: >> add a new helper method. It is unclear to me why this doesn't >> work, but GCC >> won't match it: >> >> template<std::size_t StrLen> >> bool isName(const char Str[StrLen]) const { >> return getLength() == StrLen-1 && !memcmp(getName(), Str, >> StrLen-1); >> } >> > Because it's meaningless. A parameter of array type always decays.
Right. > To > actually pass an array, you have to make it a reference: > > template <std::size_t StrLen> > bool isName(const char (&Str)[StrLen]) const Awesome, that was exactly the trick I was trying to figure out but couldn't put the pieces together. Thanks Sebastian! -Chris _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
