Checking a member exists, possibly in a base class, C++11 version
Actually, things got much easier in C++11 thanks to the decltype and late return bindings machinery. Now, it’s just simpler to use methods to test this: // Culled by SFINAE if reserve does not exist or is not accessible template <typename T> constexpr auto has_reserve_method(T& t) -> decltype(t.reserve(0), bool()) { return true; } // Used … Read more