On 07/09/15 15:54 +0100, Jonathan Wakely wrote:
@@ -457,10 +457,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return 1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value));
}
- struct _Dummy { };
- typedef typename std::conditional<_UseCache::value,
- std::bitset<_S_cache_size()>,
- _Dummy>::type _CacheT;
+ struct _Flags
+ {
+ bool _M_is_non_matching;
+ bool _M_is_ready;
+ };
+
+ struct _Empty { };
+
+ struct _ExtraMembers
+ : _Flags,
+ conditional<_UseCache::value, bitset<_S_cache_size()>, _Empty>::type
+ {
+ explicit
+ _ExtraMembers(bool __is_non_matching)
+ : _Flags{__is_non_matching, false}
+ { }
+ };
+
And we could get rid of the _Empty type, because std::bitset<0> is an
empty type anyway, so if we made _S_cache_size()==0 when _UseCache is
false then in the current code we could just unconditionally use:
using _CacheT = std::bitset<_S_cache_size()>;
and for the suggested change to use a padding byte for the _M_is_ready
flag we could use:
struct _ExtraMembers
: _Flags, bitset<_S_cache_size()>
{
explicit
_ExtraMembers(bool __is_non_matching)
: _Flags{__is_non_matching, false}
{ }
};