Helpers for Generic C++ Code Accessing Container Properties
December 12, 2020
In addition to Helpers for Generic C++ Code Iterating Over Sequences the C++17 Standard Library provides the following helpers for writing generic code:
#include <iterator> // new helpers of C++17 are defined here
template<class Container>
void foo(Container& c)
{
// Generic way to obtain:
auto data = std::data(c); // - data;
auto empty = std::empty(c); // - flag of…