
On Nov 8, 2007 8:55 PM, Michael Marcin <mmarcin@method-solutions.com> wrote:
[...] And is also not legal or portable IIRC because an implementation is allowed to add extra template parameters to a type as long as they have defaults and these would break your forward declarations.
It is techinically illegal, but in practice it works almost everywhere. When it doesn't work (for example libstdc++ in debug mode) you can fall back to including the standar headers. Also I think that there has been a defect report and now implementations are no longer allowed to add defaulted parameters to containers, but I'm not really sure about that.
IMO all standard headers should have corresponding fwd headers like the legacy iosfwd header, but since they don't AFAIK the only legal and portable way to get the type of a standard container is to include its header.
Writing compiler specific workaround and optimizations is IMHO all fine, as long as you have a safe and portable fallback. In this case the optimization is for compile time and the fallback is completely portable. -- gpd