C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Bool casting operator to check if a container not empty

From: Matthew Taylor <mjtaylor214_at_[hidden]>
Date: Thu, 19 Oct 2023 11:06:46 +0000
In addition to the suggestions you already have received, there's always if(not std::empty(vec)) as a possible alternative if you're concerned about the expressiveness of if(!vec.empty()).
Though I do need to concur with other advice that if(vec) seems to me a lot less expressive and adds more possibility for confusion than some variant of if(!vec.empty())


Received on 2023-10-19 11:06:49