libstdc++ of g++ 3.4.x: std::swap and std::auto_ptr causes compilation errors
Vinzenz Feenstra
evilissimo@web.de
Tue Nov 16 10:54:00 GMT 2004
Paolo Carlini wrote:
> Vinzenz Feenstra wrote:
>
>> std::swap of 3.4
>> template<typename _Tp>
>> inline void
>> swap(_Tp& __a, _Tp& __b)
>> {
>> // concept requirements
>> __glibcpp_function_requires(_SGIAssignableConcept<_Tp>)
>> const _Tp __tmp = __a; // <-- this is the problem in my opinion
>> __a = __b;
>> __b = __tmp;
>> }
>
>
> Yes, you are right that this is the ""problem"", in the sense that, being
> auto_ptr not Assignable, later, in __b = __tmp, its assignment operator
> wants a *non* constant reference. We (I) could revert the change which
> const-ified, correctly, the temporary, but the fundamental problem of
> your testcase would remain the same: try compiling it passing,
>
> -D_GLIBCXX_CONCEPT_CHECKS
>
> on 3.4 or
>
> -D_GLIBCPP_CONCEPT_CHECKS
>
> on 3.3 (this actually enables the concept check encoded in the
> __glibcpp_function_requires line)
>
> Paolo.
hmm
I don't understand, why I have to set it? This is strange to me, too.
Shouldn't it be setted automatically?
I mean this is confusing me abit.
Ok Thanks for explaining.
BR
Vinzenz
More information about the Libstdc++
mailing list