Teach brigand about more intel compiler limitations introduced in 18.X.

This commit is contained in:
Robert Maynard 2017-12-12 14:02:53 -05:00
parent a1a23f83d3
commit 06c5f1613f

@ -235,6 +235,19 @@ namespace detail
}
namespace brigand
{
template<typename T, typename U>
struct same
{
using type = T;
};
template<typename T>
struct same<T, std::true_type>
{
static_assert(std::is_same<T, std::true_type>::value, "");
using type = T;
};
namespace detail
{
template<class T> struct element_at;
@ -243,21 +256,20 @@ namespace brigand
{
template<class T> type_<T> static at(Ts..., type_<T>*, ...);
//CUDA 9 version that is required
template<class R, class... Other> type_<R> static at_with_type(Ts..., R, Other...);
//CUDA 9 and Intel 18 version that is required
template<class T, class... Other> T static at_with_type(Ts..., T*, Other...);
};
template<class T> T extract_type(type_<T>*);
template<std::size_t N, typename Seq> struct at_impl;
#if defined(BRIGAND_COMP_CUDA_9)
//Only needed for CUDA 9 RC1 as it has some compiler bugs
#if defined(BRIGAND_COMP_CUDA_9) || defined(BRIGAND_COMP_INTEL)
//Both CUDA 9 and the Intel 18 compiler series have a problem deducing the
//type so we are just going
template <std::size_t N, template <typename...> class L, class... Ts>
struct at_impl<N, L<Ts...>>
{
using base_with_type = decltype(
element_at<filled_list<void const*, N>>::at_with_type(static_cast<type_<Ts>*>(nullptr)...));
using type = decltype(extract_type(typename base_with_type::type{}));
using type = typename base_with_type::type;
};
#else
// This is the original implementation