unsafe STL patch

François Dumont francois.cppdevs@free.fr
Thu Feb 4 21:04:00 GMT 2010


Thanks, it is a good workaround but I had plan to introduce this 
function in debug/functions.h:

  template<typename _Iterator>
  typename __siter_base<_Iterator>::iterator_type
  __base(_Iterator __it)
  { return __siter_base<_Iterator>::__b(__it); }

__base is easier to use through out the debug containers. But in this 
case the __iter_base declaration is not enough.

Do you have an other solution or I will be forced to write 
__siter_base<_InputIterator>::__b(__first) rather than __base(__first) 
everywhere ?

IMO including debug/debug.h from bits/stl_algobase.h is not clean. Why 
algos are managed differently from containers ? There should be a 
debug/algorithm header where we could put the 
__glibcxx_check_valid_range before calling the algo implementations. 
This way the debug mode would not be visible in the non debug part of 
the lib. The only problem would be that concept checks would be 
performed after instantiation of the debug version of algos in debug 
mode, would it really be a problem ?

Sorry but I haven't receive the form, I am experimenting issues with my 
mails recently. Can you try again ?

Bests

Paolo Carlini wrote:
> On 02/03/2010 09:45 PM, Paolo Carlini wrote:
>   
>> On 02/03/2010 09:38 PM, François Dumont wrote:
>>   
>>     
>>> Hi
>>>
>>>    I kept on working on my patch and try to use __iter_base from
>>> stl_algobase.h. The problem is that there is a cyclic dependency
>>> between bits/stl_algobase.h and debug/functions.h when _GLIBCXX_DEBUG
>>> is defined. So __iter_base must be isolated in an other header. Should
>>> it be in a dedicated header or you know a header I could use ?
>>>     
>>>       
>> I don't think you need anything special because list and all the other
>> containers *already* include stl_algobase.h. Thus, just use what it
>> provides, __iter_base too.
>>   
>>     
> Ok, now I see. It's just that stl_algobase.h includes debug.h before
> defining __iter_base. Don't be slowed down now by such trivial details,
> eg, just do something like the below, and go ahead.
>
> Paolo.
>
> //////////////////
>   



More information about the Libstdc++ mailing list