1

Can you help me understand the intuition behind this kind of template specialization ?

template<typename T, typename _ = void>
struct is_list : std::false_type {};

template<typename... Ts>
struct is_list_helper {};

template<typename T>
struct is_list<
        T,
        std::conditional_t<
                false,
                is_list_helper<
                typename T::size_type,  // written only for example 
                decltype(std::declval<T>().size()), // written only for example
                >,
                void
        >
> : public std::true_type {};


BlueInf
  • 11
  • 2
  • `is_container` should be `is_list`... and this is somewhat of a convoluted version of the usual construction, which would be `struct is_list().size())>> : true_type {};` – Barry Mar 18 '20 at 18:26

0 Answers0