https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60976

--- Comment #26 from Giuseppe Ottaviano <ott at fb dot com> ---
(In reply to Jonathan Wakely from comment #25)
> There was a G++ bug (now fixed) that made void_t not work, try this
> alternative version:
> 
> template< class... > struct __voider { using type = void; };
> template< class... _T0toN > using __void_t = typename
> __voider<_T0toN...>::type;

Thanks, I finally got it to work! I also had to hack back __alloctr_rebind
because hashtable.h depended on it.

I can confirm that, on my test files, the trailing return approach is not
slower than enable_if on return. 
Since std::allocator is pretty much the only used allocator, I also tried to
add a partial specialization allocator_traits<allocator<T>> so that no SFINAE
has to be performed, and there is a non-negligible speedup:

enable_if on return type: 100% (baseline)
_Require/enable_if on extra template argument: 225%
detected_or_t/trailing return type: 100%
partial specialization for allocator<>: 89%

This is all with GCC 4.9.2 with no optimization flags. GCC 5.2 gives similar
times.

Do you use partial specializations as performance optimizations (thus
equivalent to the general case) in libstdc++?

Reply via email to