debug container mutex association

François Dumont frs.dumont@gmail.com
Wed Sep 28 19:31:00 GMT 2016


On 27/09/2016 12:32, Jonathan Wakely wrote:
> Index: include/debug/safe_base.h
>> ===================================================================
>> --- include/debug/safe_base.h    (revision 240509)
>> +++ include/debug/safe_base.h    (working copy)
>> @@ -121,11 +121,11 @@
>>     void
>>     _M_detach();
>>
>> +  public:
>>     /** Likewise, but not thread-safe. */
>>     void
>>     _M_detach_single() throw ();
>>
>> -  public:
>>     /** Determines if we are attached to the given sequence. */
>>     bool
>>     _M_attached_to(const _Safe_sequence_base* __seq) const
>
>
> Would this be a smaller change, that doesn't make the member
> accessible to all code?
>
> --- a/libstdc++-v3/include/debug/safe_base.h
> +++ b/libstdc++-v3/include/debug/safe_base.h
> @@ -50,6 +50,7 @@ namespace __gnu_debug
>   class _Safe_iterator_base
>   {
>     friend class _Safe_sequence_base;
> +    template<typename> friend class _Safe_sequence;
>
>   public:
>     /** The sequence this iterator references; may be NULL to indicate
> .
>
I am not a great fan of friend class. As long as it was friend 
declaration between iterator and sequence base types it was ok. Now that 
we need to make a template class friend I consider that it is too much 
friendship and prefer to make the necessary method public.

But if you think otherwise just tell me and I will use your approach.

François



More information about the Libstdc++ mailing list