
The main problem with a policy-based type, such as a string type with many options (flex_string for example), is that different versions of the template are different types, and as such are incompatible. An obvious solution would be a type that can hold any of the template instantiations, and dispatch the member functions to the appropriate type through virtual calls, that could eventually use the stack like boost.variant. However, this should have quite of a performance penalty, and some of the advantages of the policies (such as Small String Optimization) would become either useless (dynamic allocation) or annoying when disabled (stack allocation). An alternative would be to simply use typedef to choose the type you want to use throughout the program, which would somehow give source compatibility. How do people feel about types with lots of policies? How could those issues be addressed, for example in the case of a string type, where there is quite some demand for policies?