mercredi 29 juin 2016

Can I use the iterator Libraries' Access Functions on Nonstandard Containers?

The iterator library has been introducing a lot of access functions over the course of C++11, C++14, and C++17:

  • begin/end
  • cbegin/cend
  • crbegin/crend
  • data
  • empty
  • rbegin/rend
  • size

Can I use these on any container, even nonstandard containers (provided they supply an accessible corresponding method?) For example given a QVector foo can I do this:

const auto bar = begin(foo);

Aucun commentaire:

Enregistrer un commentaire