Jonathan Mee
I posted a solution to this problem: https://topanswers.xyz/cplusplus?q=793#a932 But found my answer only works in GCC. The function definition looks like:

    template <template <typename> class L, template <typename> class R, typename T>
    std::conditional_t<std::is_same_v<L<T>, R<T>>, std::true_type, std::false_type> IsSameContainer(const R<T>&);

I've even simplified the execution code to just deriving a variable:

    const auto test = decltype(IsSameContainer<std::vector>(param))::value

This still fails to compile on all but GCC. Does anyone have suggestions on how to make the function cross-platform?

[**Live Example**](https://godbolt.org/z/FP6o7-)
Top Answer
Jonathan Mee
This can be can be solved by accepting all template parameters rather than just the un-defaulted template parameter:

    template <template <typename...> class L, template <typename...> class R, typename... T>
    std::conditional_t<std::is_same_v<L<T...>, R<T...>>, std::true_type, std::false_type> IsSameContainer(const R<T...>&);

This will allow compilation on Clang as well: https://wandbox.org/permlink/dMvXg2ZxjPM9USi7
It can be convenient to define a templatized variable for this type as well:

    template <template <typename...> class L, typename T>
    static constexpr const auto is_same_container_v = decltype(IsSameContainer<L>(std::declval<T>()))::value;

Strangely Visual Studio will only allow my updated version of `IsSameContainer` if it is accessed through the templatized variable: https://godbolt.org/z/wBAHPm
How can I Make Clang and Visual Studio use Defaulted Template Arguments

This is a dedicated room for discussion about this question.

Once logged in you can direct comments to the question poster (or any answer poster) here.