Board index » cppbuilder » Template oddity
Roddy Pratt
![]() CBuilder Developer |
Template oddity2008-04-11 06:16:04 PM cppbuilder67 I'm trying to replace a macro-based "clear" function with a template one - but without much luck. template<typename T, std::size_t N> void CLEAR(T(&item) [N]) { memset(item, 0, sizeof(item[0]) * N); }; void test1() { char message[128]; CLEAR(message); << This compiles fine } class test2 { char message[128]; test2() { CLEAR(message); << This doesn't }; }; I get [BCC32 Error] : E2285 Could not find a match for 'CLEAR<T,N>(char *)' Have I got something wrong, or is this a BCB2007 bug? - Roddy |