It's a subjective point, but declarations of template containers in the standard library don't use the typedefs for the template type for the rest of the declaration. For example,
template <class T, class Allocator>
class deque {
public:
typedef T value_type;
//...
void push_front( const T& x );
// not void push_front(const value_type& x);
//...
}
I'm used to looking for the template parameter in member function declarations, and your use of value_type
etc. confused me.
Personally, I don't like the implicit conversion to T*
. You need to make sure you've thought of all the cases where this could cause unexpected behaviour, e.g. in boolean contexts, arithmetic operators and with ostream::operator<<
. In my opinion an extra function call on the conversion is a small price to pay for avoiding cases where code looks right, compiles and does something subtly wrong.