Hello,

currently proposed C++ Coding Conventions imply a very strict weird-is-forbidden style, which I like.

But if defining new templates should in general be avoided, I'm unsure what is the best path in converting VEC.

VEC interface optimizes element acessors to copy primitive types and point-to object types.

If VEC is to be a template class, default accessors in C++ would naturally return a (const-)reference-to anything. It would be possible to optimize accessors to return a copy instead of a const-reference-to with enable_if. All this would allow VEC to be mostly just one thing, with small variations in corresponding to VEC_last and VEC_index.

Since enable_if is not part of C++98, it would be added to GCC itself -- perhaps in namespace gcc.

This decision will not block work in the branch, of course -- VEC can be converted first unoptimized and then reoptimized with whatever tricks are allowed.

--
 P.


Reply via email to