Boost logo

Boost :

From: Giovanni Bajo (giovannibajo_at_[hidden])
Date: 2004-04-09 05:59:50

David Abrahams wrote:

>> #if BOOST_WORKAROUND(__GNUC__, == 3) && __GNUC_MINOR__ >=4
>> #include <vector>
>> #else
>> namespace std {
>> template <class T, class Allocator> class vector;
>> }
>> #endif
>> I assume (have not verified) that the problem is related to hidden
>> template parameters in the gcc-3.4 implementations of the std
>> containers.

No, it's related to a change in the internal standard library implementation
that was introduced when the debug mode was added (the debug mode adds sanity
checks for iterators and stuff). Namely, those templates are now defined in a
different namespace and then imported into namespace std through a special
extension in the compiler.

>> OR is the problem simply a bug (an regression) in gcc 3.4
> An implementation is allowed to add hidden template parameters. The
> "workaround" is actually the only portably correct code; the forward
> declaration isn't guaranteed to work. In fact, I think it invokes
> undefined behavior.

Yes, the forward declartion invokes undefined behaviour.

Giovanni Bajo

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