Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-02-06 19:12:47

> What are the fundamental differences between policy based
> implementations and implementations of separate types?
> From the user's perspective, I find it much more convenient
> to refer to std::vector<T> and fix_cap_vector<T> rather than
> generic_type<T, something_else>. To me the choice of
> policy-based vs. other approaches seems to be an implementation
> detail that should be hidden from the user.
> Unfortunately, ISO C++ does not seem to provide the means
> to achieve this for policy-based types (see

Even from a user's perspective, it's better to select the class you want by
combining its characteristics, rather than relying on a shaky, ugly naming
convention. I don't think anyone would enjoy a
fix_cap_vector_with_safe_iterators_and_bounds_checking<int>. Right?

What you want in a vector are not often implementation details, but key
behavioral distinctions that you actively want.

I agree that a nicer default template argument mechanism (such as an
exclamation mark meaning, "use the default here") would make things better,
but by and large, I don't consider this to be a problem.


Check out THE C++ Seminar: 3 Days with 5 Experts

Boost list run by bdawes at, gregod at, cpdaniel at, john at