libstdc++/41975

François Dumont frs.dumont@gmail.com
Tue Nov 15 20:13:00 GMT 2011


On 11/14/2011 11:53 PM, Daniel Krügler wrote:
> 2011/11/14 François Dumont<frs.dumont@gmail.com>:
>> 2 remarks about this new implementation:
> [..]
>> - I fail to write the static_assert checking that if hash code is not cached
>> then hash functor should be noexcept qualified, help on this point would be
>> appreciated too
> If you borrow __or_ from<type_traits>, you could write something along the
> lines of
>
> template<typename _B1, typename _B2>
> struct __or_ : conditional<_B1::value, _B1, _B2>::type
> {
> };
>
> template<typename _H1, typename _Arg>
> struct __is_nothrow_hasher : integral_constant<bool,
>    noexcept(declval<const _H1&>()(declval<const _Arg&>()))
> {
> };
>
> In _Hashtable:
>
>    static_assert(__or_<integral_constant<bool, __cache_hash_code>,
>                  __is_nothrow_hasher<_H1, _Key>>::value,
>                  "if hash code is not cached then hash functor needs to
> be noexcept");
>
> Is this what you were looking for?
>
> - Daniel
>
Yes, it is exactly what I was looking for, I am going to update my patch 
with that.

Thanks



More information about the Libstdc++ mailing list