libstdc++/41975
Daniel Krügler
daniel.kruegler@googlemail.com
Mon Nov 14 22:53:00 GMT 2011
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
More information about the Libstdc++
mailing list