
14 Jul
2004
14 Jul
'04
1:41 a.m.
Alexander Nasonov <alnsn@yandex.ru> wrote
Arkadiy, I put a reference to your library to Russian site www.rsdn.ru. Shortly after that Andrey Beliakov commented out sizer class. He writes that sizeof(sizer<N>) is not necessarily equal to N::value. Andrey suggests rewriting the sizer:
template<class N> struct sizer { typedef char(&type)[N::value]; };
and use sizer<N>::type in place of sizer<N>.
Cool! The only reason I wrote sizer in the first place was because I wasn't able to return an array from the function. And it turns out all I had to do was to use a reference to array... I will probably eliminate this class, and use char(&)[n] directly. Arkadiy