Skip to content

Instantly share code, notes, and snippets.

@vittorioromeo
Created December 9, 2013 13:41
Show Gist options
  • Save vittorioromeo/7872397 to your computer and use it in GitHub Desktop.
Save vittorioromeo/7872397 to your computer and use it in GitHub Desktop.
namespace Internal
{
template<typename T> struct IsContainerHelper
{
template<typename U,
typename Require1 = decltype(std::begin(std::declval<const U&>())),
typename Require2 = decltype(std::end(std::declval<const U&>()))>
static std::true_type test(const U*);
template<typename U> static std::false_type test(...);
using Type = decltype(test<T>(0));
const std::integral_constant<bool, Type::value> value;
};
}
template<typename T> using IsContainer = typename Internal::IsContainerHelper<T>::Type;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment